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

 

posted on 2020-11-27 15:18  秃了头也不退休  阅读(164)  评论(0编辑  收藏  举报

导航