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

Refactor package to allow for more modularity #135

Merged
merged 6 commits into from
Sep 13, 2024

Conversation

Carifio24
Copy link
Member

Something that I'd really like to add here is some unit testing, so that we can test that our endpoints are behaving the way that they should be. While this PR doesn't do that, it does set up some of the groundwork - it refactors the overall architecture so that the app is set up via a createApp function, and the database connection via getDatabaseConnection, so that these can be instantiated in the main.ts, rather than these being constants that get imported elsewhere. Additionally, each sub-router now exports a setup function (in addition to the router object itself) that takes in the app and the database and does whatever setup is necessary (currently, initializing models and setting up associations). This is called during the app setup in main.ts.

I've also added in some testing dependencies and a simple test here, but I'll actually set up the testing CI later. I mostly want to having this working and merged in because rebasing against changes to the main branch would inevitably be annoying.

@Carifio24 Carifio24 merged commit 542209c into cosmicds:main Sep 13, 2024
1 check passed
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.

1 participant