We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 6fccb55 commit 70b1024Copy full SHA for 70b1024
.gitignore
@@ -0,0 +1,2 @@
1
+# node-modules
2
+node_modules/
index.js
@@ -50,9 +50,20 @@ http
50
if (err) {
51
return console.log('Unable to scan directory: ' + err);
52
}
53
+
54
+ var index = pathname.lastIndexOf('/');
55
+ var reqPath = pathname.substring(index + 1);
56
57
+ if (reqPath === 'files') {
58
+ res.setHeader('Content-type', mimeType['.json'])
59
+ res.end(JSON.stringify(files));
60
+ } else {
61
+ res.writeHead(404, {
62
+ 'Content-type': 'text/html'
63
+ });
64
+ res.end(`<h1>Incorrect Request</h1>`);
65
+ }
66
- res.setHeader('Content-type', mimeType['.json'])
- res.end(JSON.stringify(files));
67
});
68
69
0 commit comments