【发布时间】:2018-04-16 12:55:12
【问题描述】:
我尝试将我的路由转发到控制器,但它似乎不适用于 Passport.js
router.get('/login', (req, res, next) => UserController.getLogin(req, res, next));
router.post('/login', (req, res, next) => UserController.postLogin(req, res, next));
现在,唯一不起作用的路线是使用 Passport 的路线。
static getLogin(req: Request, res: Response, next: NextFunction) {
...
}
static postLogin(req: Request, res: Response, next: NextFunction) {
passport.authenticate('local', {
successRedirect: '/success',
failureRedirect: '/failed'
});
// res.send('hello from POST'); would work
}
我正在使用 TypeScript
【问题讨论】:
标签: javascript node.js typescript passport.js