We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
2 parents fb3af87 + 47eaf3a commit 83ba98aCopy full SHA for 83ba98a
1 file changed
index.js
@@ -63,15 +63,13 @@ const createServer = (domain = "localhost") => {
63
app.use(express.static(staticPath))
64
// redirect 404 to 404.html or to index.html
65
app.use((req, res) => {
66
- if (!staticPath.startsWith("/"))
67
- staticPath = process.cwd() + "/" + staticPath
68
const p404 = staticPath + "/404.html"
69
const index = staticPath + "/index.html"
70
// istanbul ignore else: not interesting
71
if (fs.existsSync(p404))
72
- res.status(404).sendFile(p404)
+ res.status(404).sendFile(path.resolve(p404))
73
else if (fs.existsSync(index))
74
- res.status(404).sendFile(index)
+ res.status(404).sendFile(path.resolve(index))
75
else res.status(404).send(req.path + " not found.")
76
})
77
console.info("Serving static path: " + staticPath)
0 commit comments