Using express web framework to create a simple server.

Express is a lightweight web framework for developing web apps using javascript's runtime environment,node.

Here,I will show you how to create a simple server with express. First we will install express using npm.

npm i --save express

Now we create the server.

//import the express module
const express = require("express");
const app = express();

//set the port number to listen on
app.set('port',process.env.PORT || 8080);

//create a callback for listening on the server 
Listening on port ${app.get('port')}.Press CTRL Z to cancel.

In the next post,I will show you how to set up a templating engine to handle your layout pages.

Have bug-free day!

This post is also available on DEV.