# Node.js - problem with routes on heroku

**URL:** <https://forum.freecodecamp.org/t/node-js-problem-with-routes-on-heroku/167138>\
**Category:** General\
**Created:** [January 6, 2018, 1:03pm UTC](https://forum.freecodecamp.org/t/node-js-problem-with-routes-on-heroku/167138 "2018-01-06T13:03:27Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![icebergMNE](https://sea3.discourse-cdn.com/freecodecamp/user_avatar/forum.freecodecamp.org/icebergmne/32/67952_2.png) [@icebergMNE](https://forum.freecodecamp.org/u/icebergMNE)\
**Post date:** [January 6, 2018, 1:03pm UTC](https://forum.freecodecamp.org/t/node-js-problem-with-routes-on-heroku/167138/1 "2018-01-06T13:03:27Z")

</div>

Hi, I am having problem with express routes when I switch to Heroku.  
I am working on a **url shortener** project.

The problem is that when I switch to Heroku and I go to my api route, the app also goes to the first route somehow. This does not happen locally.

I have deleted the logic code so it is easier for you to see where I am having a problem.

The route that is redirecting and accepts short url string

```auto
app.get('/:short', (req,res)=>{

    console.log('redirect route')
    res.send(req.path)

})

```

The route that accepts url

```auto
app.get('/api/:string(*)', (req,res)=>{

    console.log('api route')
    res.send(req.path)

})

```

Thanks in advance for helping.

---

<div class="post-metadata">

**Author:** ![ILM](https://sea3.discourse-cdn.com/freecodecamp/user_avatar/forum.freecodecamp.org/ilm/32/363239_2.png) [@ILM](https://forum.freecodecamp.org/u/ILM)\
**Post date:** [January 16, 2021, 11:26am UTC](https://forum.freecodecamp.org/t/node-js-problem-with-routes-on-heroku/167138/2 "2021-01-16T11:26:04Z")

</div>

Closed on January 16, 2021, 11:26am UTC


