express的router

import express from 'express';

const router = express.Router();  //注意这里是大写哦

router.get('/', function(req, res) {
    res.render('index.html');
});

export default router;

 

记得还需要挂载

app.use(router);

转载于:https://www.cnblogs.com/flyerya/p/11432992.html

你可能感兴趣的:(express的router)