mirror of
https://gitee.com/docsifyjs/docsify.git
synced 2024-11-30 11:08:58 +08:00
15 lines
378 B
JavaScript
15 lines
378 B
JavaScript
|
var serveStatic = require('serve-static')
|
||
|
var http = require('http')
|
||
|
var fs = require('fs')
|
||
|
|
||
|
var notfound = fs.readFileSync('404.dev.html')
|
||
|
|
||
|
http.createServer(function (req, res) {
|
||
|
serveStatic('.')(req, res, function () {
|
||
|
res.writeHead(404, { 'Content-Type': 'text/html' })
|
||
|
res.end(notfound)
|
||
|
})
|
||
|
}).listen(3000)
|
||
|
|
||
|
console.log(`\nListening at http://localhost:3000\n`)
|