【发布时间】:2020-12-17 14:58:34
【问题描述】:
我有一个 GET /auth 路由,它接受请求并需要重定向到外部资源(比如说 https://google.com),但不是将我重定向到 https://google.com,而是将我重定向到 http:localhost:3000/api/auth/https://google.com。
是否可以以某种方式重定向到外部资源?因为现在它在我的路线中搜索路径https://google.com。
这是我的路由器:
export const loginController = async (req: Request, res: Response, next: NextFunction) => {
res.redirect('https://google.com');
};
router.get('/login', loginController);
【问题讨论】:
-
服务器使用的是什么库?试试这个:stackoverflow.com/questions/11355366/…
标签: javascript node.js express routes