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

support controllers glob for dynamic imports #396

Merged

Conversation

joni7777
Copy link
Contributor

FIX #395

Copy link
Collaborator

@dgreene1 dgreene1 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have a couple requested changes, but ultimately this is a wonderful addition. I’d like to review it more when I get more time on Monday, but this gives you a head start.

I would however like to know from @lukeautry why a glob file search wasn’t used in the first place.

By the way, I didn’t see a readme update for this. We’ll want that so people stop having to add the controllers to the index.ts.

src/config.ts Outdated Show resolved Hide resolved
src/utils/importClassesFromDirectories.ts Show resolved Hide resolved
add test for the error
add documentation about this in the README
@dgreene1
Copy link
Collaborator

I found a couple of things, but ultimately this is a fantastic contribution. Thank you so much for doing this. :) I’m looking forward to merging this after you fix the one tests and return the variables to being readonly.

@joni7777
Copy link
Contributor Author

I’m not sure why tsoa would search a file called routes.ts to find a controller. I think you meant “./custom-filerecursive-dir/**/*.controller*.ts" instead of “./custom-filerecursive-dir/**/*.routes.ts"

you are right, just in our code style we separate the controller to router and controller
in that way we achieve A real SRP with the controller only knowing business logic of the app and router to handle the http requests structure and validations

Copy link
Collaborator

@dgreene1 dgreene1 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Beautiful! Thank you so much. This will certainly help to get more people to adopt tsoa. Great work! :)

@dgreene1 dgreene1 merged commit be305e4 into lukeautry:master Aug 11, 2019
@joni7777
Copy link
Contributor Author

Do you know when this will get published to the npm?

I really need to use it :)

@dgreene1
Copy link
Collaborator

For those that come accross this:

Do you know when this will get published to the npm?

This was published in 2.4.7 I believe. I've added release notes. There will be a fix/enhancement coming in 2.4.9

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

Successfully merging this pull request may close these issues.

Support dyanimc controllers import glob
2 participants