express-router中间件
let express=require('express') let app=express() let indexRouter=require('./routes/index') let usersRouter=require('./routes/user') app.use('/index',indexRouter) app.use('/user',usersRouter) app.listen(2222)
routers/index
let express= require('express') let router=express.Router() router.get('/',function(req,res){ res.send('user') }) module.exports=router