additional keys for history mode
This commit is contained in:
@@ -24,7 +24,8 @@ const h_all = {
|
||||
}
|
||||
|
||||
const server = createServer((rq, rx) => {
|
||||
rq.method !== undefined && resp[rq.method] !== undefined && (new URL(`http://${config.host}:${config.port}${rq.url}`)).pathname === '/' ? resp[rq.method](rx) : rx.writeHead(400)
|
||||
const handler = resp[rq.method ?? '']
|
||||
handler !== undefined && (new URL(`http://${config.host}:${config.port}${rq.url}`)).pathname === '/' ? handler(rx) : rx.writeHead(400)
|
||||
rx.end(() => void console.log('%s %d %s %s', (new Date()).toISOString(), rx.statusCode, rq.method, rq.url))
|
||||
})
|
||||
server.listen(config.port, config.host, () => void console.log(`Server started at http://${config.host}:${config.port} for ${config.filename}`))
|
||||
|
Reference in New Issue
Block a user