Most Popular Tutorials
Most Popular Tutorials :-

Simply Easy Learning at Your Fingertips. Click Tutorials Menu to view More Tutorial List





How to create Node project (Express Application) using ExpressJs ?

in Node.Js, ExpressJs Generator Tool provides an environment to quickly create a basic structure of NodeJs Application.

First of all, Node.js installed on your computer. after that you create directory for your project such as mynodeproject in c drive.

open the command Terminal and go to mynodeproject folder directory using the following command – cd mynodeproject

File Name :

c:\> cd mynodeproject

Install ExpressJs Generator Tool

Install the Express generator using the following command.

c:\mynodeproject> npm install -g express-generator

Install Express Application

Run the following command to install the express application.

c:\mynodeproject> npx express --view=ejs nodeapp
###################### OR ####################
c:\> npx express --view=ejs nodeapp

above command, ejs is a template engine of the express and nodeapp is the root directory of the created express. After running the above command, you will get the following instructions

c:\mynodeproject> npx express --view=ejs nodeapp
create : nodeapp\
create : nodeapp\public\
create : nodeapp\public\javascripts\
create : nodeapp\public\images\
create : nodeapp\public\stylesheets\
create : nodeapp\public\stylesheets\style.css
create : nodeapp\routes\
create : nodeapp\routes\index.js
create : nodeapp\routes\users.js
create : nodeapp\views\
create : nodeapp\views\error.ejs
create : nodeapp\views\index.ejs
create : nodeapp\app.js
create : nodeapp\package.json
create : nodeapp\bin\
create : nodeapp\bin\www
change directory:
> cd nodeapp
install dependencies:
> npm install
run the app:
> SET DEBUG=nodeapp:* & npm start

Install Dependencies

Go to the created root folder myapp by running the following command.

c:\mynodeproject>cd nodeapp

Install dependencies using the following command

c:\mynodeproject>nodeapp> npm install

Run Express Application

File Name :

First, run the following command to start Node.js Server

c:\mynodeproject>nodeapp> npm start
####################### OR ################
node server.js
####################### OR ################
node server

nodemon server.js
########### or #########
nodemon server

After getting started the server, Run your Express App by entering the following Port in your browser.

http://localhost:3000/

Output :-

Express
Welcome to Express

ExpressJs Project Structure

ExpressJs Project structure





Previous Next


Trending Tutorials




Review & Rating

0.0 / 5

0 Review

5
(0)

4
(0)

3
(0)

2
(0)

1
(0)

Write Review Here