Labels

Wednesday 21 June 2017

ExpressJS

ExpressJS is a web application framework that provides you with a simple API to build websites, web apps and back ends.

What is Express?

Express provides a minimal interface to build our applications. It provides us the tools that are required to build our app. It is flexible as there are numerous modules available on npm, which can be directly plugged into Express.

Why Express?

Unlike its competitors like Rails and Django, which have an opinionated way of building applications, Express has no "best way" to do something. It is very flexible and pluggable.

We have set up the development, now it is time to start developing our first app using Express. Create a new file called index.js and type the following in it.

 
var express = require('express');
var app = express();

app.get('/', function(req, res){
   res.send("Hello world!");
});

app.listen(3000);
Save the file, 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 a message will be displayed as in the following screenshot.




No comments:

Post a Comment

Last day at Uki

Before Uki, I don’t know the fact that coding is like an ocean. Because I studied HTML and CSS only. I had some weaknesses like stage f...

Popular posts