[英]How do I set up an express route where parameters have multiple slashes?
I'm trying to set up an endpoint like below:我正在尝试设置如下端点:
http://localhost:5000/guardian/lifeandstyle/2020/apr/26/bring-your-skin-to-life-with-a-hint-of-bronzer
I currently set up my endpoint like this:我目前这样设置我的端点:
router.get('/guardian/:articleId', (req, res) => {
const id = req.params.articleId;
console.log(id);
axios.get('https://content.guardianapis.com/'+ id +'?api-key=' + guardianapi + '&show-blocks=all')
.then(function (response) {
res.send(response.data);
});
});
But I'm getting a 404 error once I enter the endpoint in my browser但是,一旦我在浏览器中输入端点,就会收到 404 错误
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.