server: print explicit error if a file is not foundin assets/ or client/

This commit is contained in:
jean-emmanuel 2021-10-26 19:54:13 +02:00
parent 0c57702a5b
commit 3a66388335

View file

@ -103,7 +103,14 @@ function httpRoute(req, res) {
} else if (/^\/(assets|client)\//.test(url)){
if (prod) res.setHeader('Cache-Control', 'public, max-age=2592000')
res.sendFile(path.resolve(__dirname + '/..' + url))
try {
res.sendFile(path.resolve(__dirname + '/..' + url))
return true
} catch(e) {}
console.error(`(ERROR, HTTP) File not found: ${url}`)
res.writeHead(404)
res.end()
} else {