How to Install Express in NodeJS | Express JS configuration | Configure Express in NodeJS #16

Опубликовано: 22 Январь 2024
на канале: The Code Behavior
23
5

#nodejs #meanstack #meanstacktutorial #angular #mongodb #express
#thecodebehavior #nodejscoding
Create Configuration File in NodeJS
Express JS configuration file express.js
Configure express in Node js
Express JS configuration in nodejs
How to configure Express in Nodejs

Express Configuration :
1. express The Express web framework.
2. body-parser: Middleware for parsing incoming request bodies.
3. Morgan: Middleware for logging HTTP requests.
4. path: The built-in Node.js module for working with file and directory paths.

1. bodyParser.urlencoded({ extended: false }): Middleware for parsing URL-encoded data. The extended: false option means that the parser will use the classic encoding.
2. bodyParser.json(): Middleware for parsing JSON data.
3. morgan('dev'): Middleware for logging HTTP requests. The 'dev' format provides concise output with colored status codes.

4. express.static : used to serve static files from the public directory. It uses path.join to create an absolute path to the public directory.

// Error handling middleware:

This middleware catches errors that occur during request processing. It logs the error stack to the console and sends a generic error response with a status code of 500.

MEAN Stack Tutorial
Full Stack Tutorial
Nodejs Tutorial
The code Behavior

MongoDB connection in NodeJS Express | Connect mongoDB Using Nodejs | MongoDB with NodeJS:    • MongoDB connection in NodeJS Express ...  

MEAN Stack Tutorial:    • Introduction to NodeJS | Node.js Basi...  

‪@thecodebehavior‬