187
rated 0 times
[
188]
[
1]
/ answers: 1 / hits: 5541
/ 7 Years ago, fri, march 24, 2017, 12:00:00
In my express app I have a router listening to api/shorten/
:
router.get('api/shorten/:longUrl', function(req, res, next) {
console.log(req.params.longUrl);
}
When I use something like:
http://localhost:3000/api/shorten/www.udemy.com
I get www.udemy.com
which is what I expect.
But when I use:
http://localhost:3000/api/shorten/http://www.udemy.com
I get a 404 error.
I want to get http://www.udemy.com
when I access req.params.parameter
.
More From » node.js