Ask coding questions

← Back to all posts
How can I add a 404 page to my Express web server?
h
UCYT5040

I have a node.js webserver, but I can't get a 404 page that displays a html file working. How can I fix this?

Answered by Coder100 [earned 5 cycles]
View Answer
Voters
UCYT5040
Comments
hotnewtop
Coder100

easy, right?

Make sure this is the last path you make or else the other paths after it won't get reached.

RYANTADIPARTHI

Try this:

Or you can render a page.

That should work

NoNameByProgram

@RYANTADIPARTHI one thing:
no

UCYT5040

@NoNameByProgram Thats exactly what I thought when I saw that