We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent c90ac0e commit a8d88cdCopy full SHA for a8d88cd
node/modular-http-server/public/404.html
@@ -0,0 +1,2 @@
1
+<h1>404!!!!</h1>
2
+<div>file not found</div>
node/modular-http-server/public/cat.jpg
491 KB
node/modular-http-server/server.js
@@ -0,0 +1,17 @@
+var http = require('http')
+var fs = require('fs')
3
+var ecstatic = require('ecstatic')
4
+var st = ecstatic(__dirname + '/public')
5
+var count = 0
6
+
7
+var server = http.createServer(function (req, res) {
8
+ console.log(req.method, req.url)
9
+ if (req.method === 'GET' && req.url === '/') {
10
+ res.setHeader('content-type', 'text/html')
11
+ res.end(`<h1>HOWDY</h1>
12
+ <div>you are the ${count++}th visitor</div>
13
+ <div>sign my guestbook</div>
14
+ `)
15
+ } else st(req, res)
16
+})
17
+server.listen(3000)
0 commit comments