20260827230636

This commit is contained in:
oneao committed 2026-08-27 23:06:36 +08:00
1 parent 3824af0f12
commit 35ca496b5f
15 files changed
+2313 -321

No files matched your search

+20
View File
@@ -0,0 +1,20 @@
const http = require('http')
const fs = require('fs')
const path = require('path')
const root = 'd:/workspace/code/fms'
http
.createServer((req, res) => {
const urlPath = req.url === '/' ? '/.tmp-dnd-test.html' : decodeURIComponent(req.url.split('?')[0])
const fp = path.join(root, urlPath)
fs.readFile(fp, (err, data) => {
if (err) {
res.writeHead(404)
res.end('nf')
return
}
res.writeHead(200, { 'Content-Type': fp.endsWith('.html') ? 'text/html; charset=utf-8' : 'text/plain' })
res.end(data)
})
})
.listen(8090, '127.0.0.1')
console.log('server on 8090')