Created
May 15, 2021 04:21
-
-
Save omar2205/8e98d4b9f57666b265a767b64ab8ce17 to your computer and use it in GitHub Desktop.
handle 404 in express js
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const express = require('express') | |
const app = express() | |
// ~ all routes | |
// last route | |
app.use((req, res) => { | |
res.status(404).send('Custom 404 handler') | |
}) | |
app.listen(3000, () => console.log('-- SERVER ON PORT 3000') |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment