NodeJS + Express: How to secure a URL

后端 未结 3 485
清歌不尽
清歌不尽 2021-01-29 23:48

I am using latest versions of NodeJS and ExpressJS (for MVC).

I usually configure my rest paths like this, for example:

app.get(\'/archive\', routes.arch         


        
3条回答
  •  鱼传尺愫
    2021-01-30 00:32

    Like brandon, but you can also go the connect route

    app.use('/admin', requireLogin)
    app.use(app.router)
    
    app.get('/admin/posts', /* middleware */)
    

提交回复
热议问题