Sunday, July 16, 2017

ExpressJs

ExpressJs
ExpressJS is a web application framework
node --version
v5.0.0
➧ npm --version
3.5.2

How to use npm

Globally:
npm install -g <package-name>
Locally:
npm install <package-name>

after  npm init

Then install this
➦ npm install --save express
➦ npm install -g nodemon

then create index.js
then type the following in it.

var express = require('express');

var app = express();

app.get('/', function(req, res){

res.send("Hello world!");

});

app.listen(3000);

then go to your terminal and type the following.

nodemon index.js

This will start the server. To test this app, open your browser and go to

http://localhost:3000 and you can see Hello world



No comments:

Post a Comment