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

handler.js #24

Open
charlielafosse opened this issue Apr 19, 2019 · 1 comment
Open

handler.js #24

charlielafosse opened this issue Apr 19, 2019 · 1 comment

Comments

@charlielafosse
Copy link

charlielafosse commented Apr 19, 2019

Hello it's me 🌱

A small thing but a good thing to think about at this point as projects get bigger...

You'll see that, like all groups, your handler.js file is getting fairly massive. A good way to think about restructuring and modularising this is using a handlers directory and an index.js file. You can then break up each handler into its own .js file, export each one, and import them into your index.js file in the handlers directory (and also have them exporting out of there). Then, when you want to call upon all those handlers, you'll just have to direct your router to the handlers directory and it'll automatically look for an index.js file 🐕

@charlielafosse
Copy link
Author

like this. And of course, you can use this structure for modularising other things

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

1 participant