我正在使用Passport来保护MEAN堆栈应用程序的前端和后端.该应用程序的结构如下:
monstermash
config // server configuration
public // static directory that will serve the entire Angular frontend
app
index.js // initialization of the server
models
index.js // mongoose schemas and models
passport
index.js // configuration for passport and all my strategies
routes
index.js // basic route definitions for the API (using functions defined under v1, below) and UI (routes defined inline here for simplicity's sake)
v1
index.js // all the functions called to power the API routes
Run Code Online (Sandbox Code Playgroud)
这是app/index.js因为我知道有时候需要以正确的顺序调用应用程序中间件: …