“Express () vs Express.Router ()” Kode Jawaban

Parameter rute di Node

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

Perbedaan antara Express () dan 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

Jawaban yang mirip dengan “Express () vs Express.Router ()”

Pertanyaan yang mirip dengan “Express () vs Express.Router ()”

Lebih banyak jawaban terkait untuk “Express () vs Express.Router ()” di JavaScript

Jelajahi jawaban kode populer menurut bahasa

Jelajahi bahasa kode lainnya