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

Add better integration methods to App #618

Merged
merged 2 commits into from
Jun 22, 2023
Merged

Conversation

craigbeck
Copy link
Contributor

Adding derby-webpack to the ecosystem highlighted some rough edges in setup with the existing API.

  1. writeScripts needed to be called, even if no scripts were boing written by derby, just to install listeners for app refresh
  2. backend.modelMiddleware() needed to be added to the express app, or derby would default to creating a new model that lacked a connection, so was broken (will look into this separately)

Solutions

  1. Add app.initAutoRefresh(backend) to setup listeners (better naming, not calling obtuse or private method)
  2. Add app.middleware(backend) method as obvious express integration point that sets up both the model and the router. If other middlewares is needed, existing methods backend.modelMiddleware() and app.router() are still available to add individually.

@craigbeck craigbeck requested a review from ericyhwang June 15, 2023 23:55
@craigbeck craigbeck merged commit 6cae33f into master Jun 22, 2023
@craigbeck craigbeck deleted the better-integration-api branch June 22, 2023 23:07
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.

2 participants