16 Program to handle Dynamic Route Params in ExpressJS

Program:

var express = require('express');

const { response } = require('express');

const { request } = require('http');



var app = express();



app.get('/home',function(request,response){

    response.send("This is my HomePage");

});





app.get('/posts/:id',function(request,response){



 response.send("This is post: "+ request.params.id);  

});



app.listen(5000);


Output:

Dynamic Route Params in ExpressJS

Previous
Next Post »