# I can't expand the default routes

**URL:** <https://community.forestadmin.com/t/i-cant-expand-the-default-routes/146>\
**Category:** Help me!\
**Created:** [May 12, 2020, 10:56am UTC](https://community.forestadmin.com/t/i-cant-expand-the-default-routes/146 "2020-05-12T10:56:50Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![AlexandreDeMoura](https://avatars.discourse-cdn.com/v4/letter/a/e19b73/32.png) [@AlexandreDeMoura](https://community.forestadmin.com/u/AlexandreDeMoura)\
**Post date:** [May 12, 2020, 10:56am UTC](https://community.forestadmin.com/t/i-cant-expand-the-default-routes/146/1 "2020-05-12T10:56:50Z")

</div>

Hi guys,  
I’ve been using Forest for about a year and I’m very satisfied with it.  
I never needed complexe features, but now I do and I’m having a hard time expanding the default routes.

## Expected behavior

Be able to expand the route for the put request of my models.

## Actual behavior

The code in my route is never executed when I modify one of my Mission’s element in the Forest UI.

```javascript
  router.put('/Mission/:id', (req, res, next) => {
    console.log(req.body);
    next();
  });

```

## Context

- forest-express-sequelize version: 6.1.2
- express version: 4.16.3
- sequelize version: 5.8.11

Thanks !

---

<div class="post-metadata">

**Author:** ![anon39848301](https://avatars.discourse-cdn.com/v4/letter/a/b9e5f3/32.png) [@anon39848301](https://community.forestadmin.com/u/anon39848301)\
**Post date:** [May 12, 2020, 11:12am UTC](https://community.forestadmin.com/t/i-cant-expand-the-default-routes/146/2 "2020-05-12T11:12:56Z")

</div>

Hi @AlexandreDeMoura,

Could you give me more context about your issue (Network tabs of your browser, logs of your server if any, etc)? I guess if you route is not called, the corresponding call in the network tabs of your browser return a 404, right ?

My first guess would be that your URL should be fully writing with lower case (`/mission/:recordId`), but I might be more helpful with a little more informations 🙂

You can find the documentation [here](https://docs.forestadmin.com/documentation/reference-guide/routes/override-a-route) for overriding a route if that can help.

---

<div class="post-metadata">

**Author:** ![AlexandreDeMoura](https://avatars.discourse-cdn.com/v4/letter/a/e19b73/32.png) [@AlexandreDeMoura](https://community.forestadmin.com/u/AlexandreDeMoura)\
**Post date:** [May 12, 2020, 12:43pm UTC](https://community.forestadmin.com/t/i-cant-expand-the-default-routes/146/3 "2020-05-12T12:43:15Z")

</div>

Hi @anon39848301 and thank you for you time !  
Well the api call is working perfectly fine

 ![Capture d’écran 2020-05-12 à 14.26.42](https://europe1.discourse-cdn.com/flex013/uploads/forest/original/1X/61ff1515bab58be3449fb14b8bf6cef3c42cb4bc.png)

I just can’t access it on my code to expand his functionality.  
What I don’t understand is that, if I put my code in app.js instead of /routes/Mission.js, then I can execute my code inside the router.

```javascript
const express = require('express');
const requireAll = require('require-all');

const app = express();

app.put('/forest/Mission/:id', (req, res, next) => {
  console.log("test");
  next();
})

requireAll({
  dirname: __dirname + '/middlewares',
  recursive: true,
  resolve: Module => new Module(app),
});

module.exports = app;

```

In this situation, I can trigger the console.log() every time I update my Mission element in the UI.

---

<div class="post-metadata">

**Author:** ![anon39848301](https://avatars.discourse-cdn.com/v4/letter/a/b9e5f3/32.png) [@anon39848301](https://community.forestadmin.com/u/anon39848301)\
**Post date:** [May 12, 2020, 1:38pm UTC](https://community.forestadmin.com/t/i-cant-expand-the-default-routes/146/4 "2020-05-12T13:38:33Z")

</div>

I just tried to generate a new lumber project to check if I’m able to reproduce, but unfortunately, everything seems fine on my side using for eg. editing PUT route on my `car` model  
in `/routes/cars.js`

```javascript
// Update a Car
router.put('/cars/:recordId', permissionMiddlewareCreator.update(), (request, response, next) => {
  // Learn what this route does here: https://docs.forestadmin.com/documentation/v/v6/reference-guide/routes/default-routes#update-a-record
  console.warn('here');
  next();
});

```

Did you edit anything in the `app.js` file ? In your sample, I can’t see the `requireAll` of the `routes` file, but I guess since everything work with the default code, this part should be fine.

Adding the route where you tried it will definitely work, since you added it before any other routes of the app.

Is there a possibility that another `Mission/:id` route is already declared elsewhere ?

---

<div class="post-metadata">

**Author:** ![AlexandreDeMoura](https://avatars.discourse-cdn.com/v4/letter/a/e19b73/32.png) [@AlexandreDeMoura](https://community.forestadmin.com/u/AlexandreDeMoura)\
**Post date:** [May 12, 2020, 2:27pm UTC](https://community.forestadmin.com/t/i-cant-expand-the-default-routes/146/5 "2020-05-12T14:27:59Z")

</div>

I have generated a new project and indeed it’s working fine.  
My project was pretty outdated so I think it was the problem.

Thanks again for your time !

---

<div class="post-metadata">

**Author:** ![Yoad\_Snapir](https://dub1.discourse-cdn.com/flex013/user_avatar/community.forestadmin.com/yoad_snapir/32/101_2.png) [@Yoad\_Snapir](https://community.forestadmin.com/u/Yoad_Snapir)\
**Post date:** [May 13, 2020, 5:26am UTC](https://community.forestadmin.com/t/i-cant-expand-the-default-routes/146/6 "2020-05-13T05:26:07Z")

</div>

Also, note that there is no permissions mw here - it is possible that for some reason this is not working also due to that and anyway - this is not a good example of how to override your routes 🙂
