Learn Express.js
Let’s get this started…
I will start out by
(1)Briefly introducing Express.js,
(2) Features of Express.js, and then
(3) Express.js Installation
to get a better understanding of Express.js fundamentals.
1) What is Express.js?
Express.js is a web application framework that is built on top of Node.js.
Express provides a minimal interface to build our applications. It provides us the tools that are required to build our app.
It is very flexible and pluggable.
Pug
Pug is a terse language for writing HTML templates. It −
- Produces HTML
- Supports dynamic code
- Supports reusability (DRY)
It is one of the most popular template language used with Express.
Express was developed by TJ Holowaychuk and is maintained by the Node.js foundation
Express is majorly responsible for handling the backend part in the MEAN stack. Mean Stack is the open-source JavaScript software stack. Here, MEAN stands for MongoDB, Express.js, and Node.js.
Next, I’ll focus on what?
2) Features of Express.js
- Express follows the Model-View-Controller (MVC) architecture
- Allows to set up middlewares to respond to HTTP Requests.
- Defines a routing table that is used to perform different actions based on the HTTP Method and URL.
- Allows to dynamically render HTML Pages based on passing arguments to templates.
- It helps in simplifying the configuration and customization steps for the application.
3) Installing Express.js
In order to install Express.js in your system, first, you need to make sure that you have Node.js already installed.
Once you are done with Node.js installation, the next step is to install Express
To install Express.js, first, you need to create a project directory and create a package.json file that will be holding the project dependencies.
Below is the code to perform the same:
Now, you can install the express.js package in your system. To install it globally, you can use the below command
Or, if you want to install it locally into your project folder, you need to execute the below command:
Now that you are already done with the installation process.
And that’s the end of this post on Express.js!
I hope you found this helpful and get a good grasp of the basics of document-based. If you enjoyed this piece, I’d love it if you hit the clap button 👏
See you soon…..