# Can't read the url for URL shortener project

**URL:** <https://forum.freecodecamp.org/t/cant-read-the-url-for-url-shortener-project/36189>\
**Category:** General\
**Created:** [September 12, 2016, 4:39pm UTC](https://forum.freecodecamp.org/t/cant-read-the-url-for-url-shortener-project/36189 "2016-09-12T16:39:09Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![stanleyyylau](https://avatars.discourse-cdn.com/v4/letter/s/e0b2c6/32.png) [@stanleyyylau](https://forum.freecodecamp.org/u/stanleyyylau)\
**Post date:** [September 12, 2016, 4:39pm UTC](https://forum.freecodecamp.org/t/cant-read-the-url-for-url-shortener-project/36189/1 "2016-09-12T16:39:09Z")

</div>

`var express = require(‘express’);  
var app = express();

app.get(’/new/:url’, function(req, res){  
console.log(req.params.url);  
})

app.listen(‘5000’, function(){  
console.log(‘Server is on…’);  
});  
`

When I make a request to [http://localhost:5000/new/test](http://localhost:5000/new/test)

It’s fine, it’s logging “test”

But when I [http://localhost:5000/new/http://www.baidu.com](http://localhost:5000/new/http://www.baidu.com)

It gives me nothing…

I search this forum and realise I have to put a “\*” at the end of route like this…

`app.get('/new/:url*', function(req, res){ console.log(req.originalUrl); })`

Now when I make a request to [http://localhost:5000/new/http://www.baidu.com](http://localhost:5000/new/http://www.baidu.com) it will log out new/[http://www.baidu.com](http://www.baidu.com) just fine. but I do not understand why putting an \* will make it work. can anyone further explain this?

thanks  
Stanley

---

<div class="post-metadata">

**Author:** ![BenGitter](https://sea3.discourse-cdn.com/freecodecamp/user_avatar/forum.freecodecamp.org/bengitter/32/12192_2.png) [@BenGitter](https://forum.freecodecamp.org/u/BenGitter)\
**Post date:** [September 12, 2016, 5:25pm UTC](https://forum.freecodecamp.org/t/cant-read-the-url-for-url-shortener-project/36189/2 "2016-09-12T17:25:05Z")

</div>

Not really sure, but I suppose it has to do with the slashes in the url. My guess is that express “thinks” that everything after it is a subpath.

---

<div class="post-metadata">

**Author:** ![jwilkins.oboe](https://sea3.discourse-cdn.com/freecodecamp/user_avatar/forum.freecodecamp.org/jwilkins.oboe/32/179497_2.png) [@jwilkins.oboe](https://forum.freecodecamp.org/u/jwilkins.oboe)\
**Post date:** [January 16, 2021, 5:29am UTC](https://forum.freecodecamp.org/t/cant-read-the-url-for-url-shortener-project/36189/3 "2021-01-16T05:29:38Z")

</div>


