How to add a 404 Error Page in the Express ? Last Updated : 28 Jun, 2021 Comments Improve Suggest changes Like Article Like Report Express.js is a powerful framework for node.js. One of the main advantages of this framework is defining different routes or middleware to handle the client's different incoming requests. In this article, we will discuss how to add a 404 error page i.e not found using the express server. 404 is the status code which means not found in the server. Installing module: Install the required module using the following command. npm install expressProject structure: It will look like this. Â index.js // Requiring module const express = require("express") const app = express() // Handling GET /hello request app.get("/hello", (req, res, next) => { res.send("This is the hello response"); }) // Handling non matching request from the client app.use((req, res, next) => { res.status(404).send( "<h1>Page not found on the server</h1>") }) // Server setup app.listen(3000, () => { console.log("Server is Running") }) Run the index.js file using the below command: node index.jsOutput: Now open your browser and go to http://localhost:3000/, the server will respond no page found. Comment More infoAdvertise with us Next Article How to add a 404 Error Page in the Express ? Z zack_aayush Follow Improve Article Tags : Web Technologies Node.js NodeJS-Questions Similar Reads How to Redirect 404 errors to a page in Express.js ? Express Js is a web application framework based on Node.js web server functionality that helps us to create web servers with lesser complexity and in a well-organized manner. Express provides routing services that help us in creating application endpoints that respond based on the HTTP request metho 3 min read How to Create 404 Error Page in Bootstrap ? Every website encounters errors sometimes, so it becomes important to show these errors in a presentable manner to the users. Creating a custom 404 error page using Bootstrap 5 can enhance the user experience when visitors encounter a page that doesnât exist. Below are the types of 404 Error Page we 2 min read How To Create 404 Pages in Tailwind CSS? Creating a 404 error page using Tailwind CSS is simple and effective. Tailwind CSS allows you to quickly style and layout your page using its utility-first CSS framework.In this article, we'll see the process of designing a custom 404 page with an engaging design to keep users informed and on track 2 min read How to use the app object in Express ? In Node and Express, the app object has an important role as it is used to define routes and middleware, and handling HTTP requests and responses. In this article, we'll explore the various aspects of the `app` object and how it can be effectively used in Express applications. PrerequisitesNode.js a 3 min read How to pass express errors message to Angular view ? There are mainly two parts of a web application, one is front-end and another is the backend. We will start with the backend first. The express catches all errors that occur while running route handlers and middleware. We have to just send them properly to the frontend for user knowledge. Express ca 4 min read Like