Tsed: [Question] Option to set the controllers mounting order

Created on 2 Jul 2018  路  2Comments  路  Source: tsedio/tsed

Hi Romakita, how are you :)

It has been a while since my last interaction with this great framework. <3

And I have a question with the following config:

@ServerSettings({
  ...
  mount: {
    api: `${rootDir}/controllers/*Ctrl.js`
  },
  ...

If I have two controllers commentCtrl.ts and projectCtrl.ts, the order of mounting will be alphabetical and the endpoints of the commentCtrl will be registered first. But If I want to mount the projectCtrl.ts first and before commentCtrl.ts because I want to validate all project routes first, how can one achieve this?

I tried the following with no luck:

  mount: {
    api: `${rootDir}/controllers/projectCtrl.js ${rootDir}/controllers/commentCtrl.js`
  },

Thanks again, Romakita for your support.

question

Most helpful comment

@m0uneer Here the solutions:

mount: {
    api: [
         ProjectCtrl // with manual import,
        `${rootDir}/controllers/projectCtrl.js` // or with componentScan,
        CommentCtrl // with manual import,
        `${rootDir}/controllers/commentCtrl.js` // or with componentScan
    ] 
  },

See you :)

All 2 comments

@m0uneer Here the solutions:

mount: {
    api: [
         ProjectCtrl // with manual import,
        `${rootDir}/controllers/projectCtrl.js` // or with componentScan,
        CommentCtrl // with manual import,
        `${rootDir}/controllers/commentCtrl.js` // or with componentScan
    ] 
  },

See you :)

Thanks, bro :)

Was this page helpful?
0 / 5 - 0 ratings

Related issues

tobiasmuecksch picture tobiasmuecksch  路  6Comments

S0ulan picture S0ulan  路  4Comments

yangukmo picture yangukmo  路  5Comments

teusemanuel picture teusemanuel  路  4Comments

RickStanley picture RickStanley  路  6Comments