EXPRESS

 EXPRESS.JS- it is a framework that helps us to make web applications

used for bulding server side programming

it listens for incomig requests

it parses the request

to match response with routes(paths through requests are sent)

giving the suitable response 

can be downloaded by the command: npm install express



before installation create a seperate directory and create a package in it

create an index file in the directory and write the code

express needs to be required and the express function returns an object stored in APP\


const express=require("express");
const app=express();
console.dir(app);

APP has many properties and methods that can be used

It has an important method called listen() which listens the incoming requests

it has two properties PORT and arrow function

PORT - it is a logical end point of a nerwork connection that is used to exchange information between a website and a webserver

port=3000 and 8080 are used for building custom servers

let port=3000;
app.listen(port,()=>{
    console.log(`app is listening on port ${port}`);

})

they can be hosted on the browser by the command : localhost:port
when the server is runnig the result would be


to stop the server press CTRL+C






Comments

Popular posts from this blog

DATABASE RELATIONSHIPS

ROUTING (GET /) home route

Query Strings