post-cover

how to setup express framework on node js

Friday, June 17th 2022

nodejsexpress

What is express framework?

Express is a minimal and flexible Node.js web application framework that provides a robust set of features for web and mobile applications. so Express is a node js web application framework that provides broad features for building web and mobile applications. It is used to build a single page, multipage, and hybrid web application. It's a layer built on the top of the Node js that helps manage servers and routes. (source : https://expressjs.com/ ).

**make sure you have node and npm installed on your machine, to start this tutorial.

you can check it by typing : node -v & npm -v

if it is installed will appear as shown. then we can get into the use of express js.

1. Init node js project

create and enter into that folder, then type npm init -y in the terminal with the folder location.

npm init : be used to set up a new or existing npm package.

-y : to skip all questions about project initialization

2. Install and Using Express Js

type npm i express, then wait for the installation process to complete. and create a file with the name app.js. after that, in app.js type the following code :

after that, you can open localhost:8008 in the browser or just click from the terminal. then you will see the words "hello world | express js" in the browser. it means express has been successfully installed and is ready for further development.