mirror of
https://github.com/remko/waforth
synced 2025-01-13 08:01:32 +01:00
fix dev server crash on file not found
This commit is contained in:
parent
74bb57b72e
commit
ef01a303ca
1 changed files with 6 additions and 2 deletions
|
@ -117,8 +117,12 @@ if (watch) {
|
|||
// Simple static file server
|
||||
createServer(async function (req, res) {
|
||||
let f = path.join(__dirname, "public", req.url);
|
||||
if ((await fs.promises.lstat(f)).isDirectory()) {
|
||||
f = path.join(f, "index.html");
|
||||
try {
|
||||
if ((await fs.promises.lstat(f)).isDirectory()) {
|
||||
f = path.join(f, "index.html");
|
||||
}
|
||||
} catch (e) {
|
||||
// pass
|
||||
}
|
||||
try {
|
||||
const data = await fs.promises.readFile(f);
|
||||
|
|
Loading…
Reference in a new issue