'different between router in node js
what is difference between routing method in express() and in router() function in express()?
const express=require('express');
const app=express();
const router=express.router();
//routing with express
app.get(/,(req,res)=>{
res.send('Get method with express');
});
//routing with router function in express
router.get('/',(req,res)=>{
res.send('Get method with router in express')
});
which on for routing is better? which one should i use?
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
