Appearance
js
// routes/atricle.js
const article = (() => {
const router = express.Router()
router.get('/foo', (req, res, next) => {
res.end('atricle foo')
})
router.get('/bar', (req, res, next) => {
res.end('atricle bar')
})
return router
})()
// routes/user.js
const user = (() => {
const router = express.Router()
router.get('/foo', (req, res, next) => {
res.end('user foo')
})
router.get('/bar', (req, res, next) => {
res.end('user bar')
})
return router
})()
app.use('/article', article)
app.use('/user', user)