“Express () vs express.router ()” Code-Antworten

Routenparameter im Knoten

var express = require('express');
var fs  = require('fs');
var app= express();
 app.get('/index/profile/:id',function(req,res){
    //  res.send('profile with id' + req.params.id)

    
    
 });
app.listen(3000,'127.0.0.1');
console.log('lsitng');
Beautiful Badger

Differenz zwischen Express () und Express.router ()

var express = require('express');

var router = express.Router();

router.get('/', function(req, res) {
    res.send('GET handler for /dogs route.');
});

router.post('/', function(req, res) {
    res.send('POST handler for /dogs route.');
});

module.exports = router;
Yawning Yak

Express () vs express.router ()

var express = require('express');

var router = express.Router();

router.get('/', function(req, res) {
    res.send('GET handler for /dogs route.');
});

router.post('/', function(req, res) {
    res.send('POST handler for /dogs route.');
});

module.exports = router;
Clean Crane

Ähnliche Antworten wie “Express () vs express.router ()”

Fragen ähnlich wie “Express () vs express.router ()”

Weitere verwandte Antworten zu “Express () vs express.router ()” auf JavaScript

Durchsuchen Sie beliebte Code-Antworten nach Sprache

Durchsuchen Sie andere Codesprachen