From cfc2d3bc9aeadd028f82015b7849c9373fa4b459 Mon Sep 17 00:00:00 2001 From: Kfir Dayan Date: Sun, 2 Apr 2023 17:03:31 +0300 Subject: [PATCH] 404 --- src/index.ts | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/index.ts b/src/index.ts index b9f4ca3..5f58443 100644 --- a/src/index.ts +++ b/src/index.ts @@ -63,4 +63,9 @@ webServer.use(express.static('public')) webServer.listen(process.env.PORT, () => { console.log('Example app listening on port '+process.env.PORT+'!') +}) + +// when client try to access 404 file +webServer.use(function (req, res, next) { + res.status(404).send("Sorry can't find that!") }) \ No newline at end of file