我有以下帖子
router.post('/auth',oauth.oAthmiddleware, function(req, res) {
oauth.auth;
});
它返回访问令牌和其他详细信息
我有另一篇文章
router.post('/refreshToken', function(req, res,next) {
var username = 'change';
var password = 'change';
req.body.username = username;
req.body.password = password;
// call '/auth' post
});
在上面我已经改变并调用上面的帖子,并希望从内部帖子返回响应
我怎样才能实现相同的目标
谢谢
你可以这样做:
router.post('/refreshToken', function(req, res,next) {
req.url = '/auth'
...
req.body.password = password;
return router._router.handle(req, res, next);
});