Making 404 Error on glitch

Yes! its possible and easy, first you need these things:

  • Express project
  • Main file (server.js, index.js etc.)

So after making the project you will see this in your main file:

After that add line!
put this code

 app.get("/*", (request, response) => {
      response.sendFile(__dirname + "/views/404.html");

So β€˜/*’ will be the para after your website, this will checks if that para exist or not
if not it will show error


The 404.html file


Heres the output: image

Hope it helps :slight_smile:

If it make sure to click :heart: button! it will rlly appriciate.


Wow it rlly helps me!1 thank you so much i rlly needed that…

1 Like