EDIT: Fixed it, see last line

I'm having trouble defining a custom route. I'm following the guide here: https://docs.espocrm.com/development.../#custom-route

I've created a new Entity called MailingList (yes, I know Target Lists are a thing, but this is mostly just me getting the hang of how it all works) and it seems to work ok.


After a bit of confusion of when to use Camel Case and when to use hyphens, I got my entity and a controller working. I can go to <my-url>/#MailingList/hello/ and it'll run the function defined in my controller, here:
Code:
define('custom:controllers/mailing-list', ['controllers/record'], function (Dep) {

    return Dep.extend({

        actionHello: function (options) {
           alert('hello');
           console.log('action: hello');
           console.log(options);
       },

       actionNewfunc: function (options) {
          alert('New function!');
          console.log('action: newfunc');
          console.log(options);
       },

       actionTest: function (options) {
          alert("Object ID: "+options.id);
          if (!options.id) throw new Espo.Exceptions.NotFound();

          console.log('action: test');
          console.log(options);
       },

   });
});
Now, I tried to create a custom route, in custom\Espo\Custom\Resources\metadata\app\clientRo utes.json

This is my routing code:
Code:
"MailingList/toast/:id": {
    "params": {
        "controller": "MailingList",
        "action": "test"
    }
}
The idea being that if I go to something like <my-url>/#MailingList/toast/647 it'll run the 'test' function. However if I try this I get a 404. I've cleared cache and rebuilt.

It works if I use <my-url>/#MailingList/test/647 but of course, because the 'id' variable isn't defined in the routing, options.id is undefined. It looks like it's just completely ignoring my routing json.



EDIT: Worked it out, I was being an idiot..... my json file was missing the opening and closing brackets.