In this blog post, we will see how to start with expressjs and create your first hello world application
Express is a minimalist frontend framework of nodejs. This framework can be used to create fast and robust apis, mobile app backends, small websites, and many more things. We will straight away get into how to create your first application. This blogs assumes you already have a background knowledge of working with nodejs.
To install express simple run
$ npm install express
*assuming you have nodejs installed already this will install express
Fastest way to get started with express is to use express-generator. It creates a directory structure and pre-defined files which help you to get started with express.
To install express generator use
$ npm install express-generator
Lets name our project “helloworld”, so to create an express project. Simply run
It will create various directories and files for your application.
Next we need to install dependencies relating to the project
cd helloworld npm install
now finally to run your application do
set DEBUG=helloworld & node ./bin/www
On ubuntu/linux you don’t get the bin/www folder then follow this process to install
$ npm -g install express $ npm -g install express-generator
And if you get errors like ‘debug’ module not found, then run npm install for each module
npm install debug
Now in your browser if you open http://127.0.0.1:3000 you see your first express app.