Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

loadControllers Not import sub directory #115

Open
amwkr opened this issue Dec 3, 2019 · 1 comment
Open

loadControllers Not import sub directory #115

amwkr opened this issue Dec 3, 2019 · 1 comment

Comments

@amwkr
Copy link

amwkr commented Dec 3, 2019

When using controller directory have subdicrectory.

directory example

src
├── controller
│   └── host
│       └── host-first-controller.ts
│       └── host-second-controller.ts
│   └── guest
│       └── guest-first-controller.ts
│       └── guest-second-controller.ts
│   └── main-controller.ts

I try include controller /**/*.ts but only load main-controller.ts

Server.loadControllers(this.app, 'controller/**/*.ts', __dirname);

Temporary use directly load directory.

Server.loadControllers(this.app, 'controller/*.ts', __dirname);
Server.loadControllers(this.app, 'controller/host/*.ts', __dirname);
Server.loadControllers(this.app, 'controller/guest/*.ts', __dirname);

please fix load subdirectory use /**/*.ts.

@mimiz
Copy link

mimiz commented Jul 28, 2020

Hi,
I think that your code can not work once compiled, it will work in typescript (ie: if you run your code with ts-node), but not after compilation ... as the string controller/**/*.ts will not change, so, as after compilation phase, all your files are changed to javascript (with a js extension) so it will not match anything.

Try to do something like this :

Server.loadControllers(this.app, 'controller/**/*.js', __dirname);

Or

Server.loadControllers(this.app, 'controller/**/*Controller.*', __dirname);

Just do not reference .ts files ...

Regards ...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants