Express is a web application framework of node js. It offers a range of features for building mobile and web applications - from building a single page, to multipages, and an entire hybrid web application. Express JS acts as a layer above Node js, helping manage servers and routes.
Advantages of Using Express JS
- Express is unopinionated, and you can customize it.
- For request handling, you can utilize Middleware.
- A single language is used for development on the frontend and backend.
- Express links quickly with databases like MySQL, MongoDB, etc.
- Express offers the feature of dynamic rendering of HTML Pages via the passing arguments to templates.
The express framework was created for node js because it is:
- Easy to learn
Express JS Installation on a Windows Machine
In this, you will install Express js, but before that, you need to install node js first because express is a web application framework of node js.
Steps to install node js:
- Step 1 - Download Node.js from https://nodejs.org/en/download/.
- Step 2 - Select the Windows installer suitable for your system (32-bit or 64-bit)
- Step 3- Install it
- Step 4 - Press the next button and then this will install Node.js
- Step 5 - Press the finish button.
- Step 6 - Open your command prompt and check the version of node js by entering the command: node -- version
- Step 7 - Now, open your visual studio code, open a new terminal and install npm (node package manager)
- write command: npm -- global
- Step 8 - After installing npm, you must check the version of npm
- Command: npm -v
- Step 9 - Now you will be creating express, for that, first, you need to create a separate folder where you will keep all the modules and files of express js.
- Step 10 - Open a new terminal write a command:
mkdir simplilearn this will create a folder
- Step 11 - Now, inside that folder create a file app.js, press the add file button then write your file name
- Step 12 -Once the file has been created, you will need to install a package manager that is the npm open terminal. Go to the main folder that you have created, that is cd Simplilearn
- Step 13 - write command: npm init
Description express by Simplilearn
Author - Simplilearn
After this, you can see npm created a JSON file inside your
- Step 14 -Now you will finally install express js for that write command: npm install express
With this Express js will have gotten installed on your system
- Step 15 - Now write your first basic program in which you will print “Welcome To Simplilearn” on the server.
- Step 16 - Open the terminal, go to the main folder write ‘cd simplilearn’, press enter, and then write the command to run the code: node app.js
- Step 17 - Now, you can see it is printing your message ‘Listening to port 4000’
- Step 18 - Now open chrome, and write: localhost:4000
Step 1 - Press enter, following which it will print a welcome message
Hopefully this tutorial on “installation of express js ” helped you know what is express js, the advantages of express js and you learned how to install express js on windows machines.
To learn more about Express, you can enroll in Simplilearn's Node JS certification training. This certification training course will help you gain in-depth knowledge and concepts of Express.js, Node Packet Manager (NPM), NPM Vet, REST, shrink-wrap, Express.js with MongoDB, and SQLite CRUD operations. This Express JS training focuses on the essential concepts of Node JS and Express Js which provides hands-on experience in building an HTTP server.
If you have any questions or feedback, do let us know in the comments section of the “Express js installation” tutorial, and our experts will get back to you as soon as possible.