Answer the question
In order to leave comments, you need to log in
How to split Express Router into modules?
I want to break routes into modules and collect them in one file. Here is what I want to achieve:
index.js
// ...
const routes = require('./routes')
app.use('/', routes)
// ...
const router = require('express').Router()
const BlogController = require('./BlogController')
router.get('/', BlogController.All)
// ... другие роуты
module.exports = router
// Вот здесь хочется собрать все модули и экспортировать
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question