Explain Routing in Express.js?

devquora
devquora

Posted On: Feb 22, 2018

 

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')
});

    Related Questions

    Please Login or Register to leave a response.

    Related Questions

    Mean Stack Interview Questions

    What is the Mean Stack?

    Mean stack is combination four popular JavaScript-based technologies MongoDB, Express, AngularJS and Node that allows d..

    Mean Stack Interview Questions

    What is Express?

    Express is lightweight web framework for Node.js.It provides robust and scalable solutions to build single and multi-pa..

    Mean Stack Interview Questions

    Explain Mongoose?

    Mongoose is a MongoDB Object Data Modeling (ODM) library for MongoDB and NodeJS.It provides a straight-forward, schema-..