Express: How to pass app-instance to routes from a different file?

后端 未结 8 1050
误落风尘
误落风尘 2020-11-29 16:34

I want to split up my routes into different files, where one file contains all routes and the other one the corresponding actions. I currently have a solution to achieve thi

8条回答
  •  南方客
    南方客 (楼主)
    2020-11-29 17:02

    For database separate out Data Access Service that will do all DB work with simple API and avoid shared state.

    Separating routes.setup looks like overhead. I would prefer to place a configuration based routing instead. And configure routes in .json or with annotations.

提交回复
热议问题