Hello guys, this blog post will cover following things:
- Introduction to express-generator
- Installing express-generator
- Creating project using express-generator
- Run Project
Ok, so lets get start with it…
Introduction to express-generator
Express-generator is the tool to which builds application skeleton very quickly for you.
It’ll install the express CLI for you.
Installing express-generator
You can get express-generator from npm site and install in your system using one simple command:
npm install -g express-generator
It’ll take couple of minutes of time to install…
Once this done we’ll create our project using express command.
Creating project using express-generator
Now that we’ve installed express-generator, we can use express command to create our very first nodejs project using express-generator. 🙂
Run following command to create project:
express <project-name>
Here, <project-name> is the project and directory name of your choice… like express express-example.
This will create all the necessary files for your project:
Great….now let’s run our project…
Run Project
Before running the project we have to install our dependencies. For that cd into the project directory
cd express-example
and install dependencies
npm install
This usually takes couple of minutes…till then you can review the project directory ¯\\_(ツ)_/¯
Once that is done run npm start…Â Now your project is up and running on 3000 port.
So if you go http://localhost:3000 you can see the express landing page.
Same thing I’ve explain in the video with changing routes and variable values here: