1.

Explain Routing In Express.js?

Answer»

Routing is a mechanism used by frameworks to decide how a URL/endpoint is responded/handled by the server. Express provides an excellent way to handle APPLICATIONS routing.

Below is basic code to handle routing in Express:

var express = REQUIRE('express')

var app = express()

respond with "hello world" when a GET request is MADE to the HOMEPAGE

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

res.send('hello world')

});

Routing is a mechanism used by frameworks to decide how a URL/endpoint is responded/handled by the server. Express provides an excellent way to handle applications routing.

Below is basic code to handle routing in Express:

var express = require('express')

var app = express()

respond with "hello world" when a GET request is made to the homepage

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

res.send('hello world')

});



Discussion

No Comment Found