我正在 Node.js 上构建 ExpressJS Web 应用程序。
我有一个通过 GET 路由呈现的页面:“http://localhost:3000/items/showItemList?status=0 ”。
此页面调用 POST:“http://localhost:3000/items/approve ”。
在 POST 路由中,我想获取原始页面“http://localhost:3000/items/showItemList?status=0”的 URL。
router.post('/approve', async function(req, res, next) {
// How to get the Url to the originating page.
});
最佳答案
您可以像这样从req
param获取
req.headers.referer
关于javascript - Node.js:如何从请求正文中获取调用 POST 的页面的 URL?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/53663004/