-
-
Couldn't load subscription status.
- Fork 10
feat: change @fastify/restartable api #40
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
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good work! I've left a couple of comments on the API shape.
example.mjs
Outdated
| port: 3000, | ||
| app: myApp | ||
| }) | ||
| const app = await restartable(createApp, fastify, { logger: true }) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| const app = await restartable(createApp, fastify, { logger: true }) | |
| const app = await restartable(createApp, { logger: true }) |
I think this API would be better
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@fastify/restartable should not depend on a specific version of fastify. That means users should be able to pass the fastify factory.
test/index.test.js
Outdated
| teardown(stop) | ||
|
|
||
| const { address, port } = await listen() | ||
| const host = await app.listen({ host: '127.0.0.1', port: 5844 }) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we avoid hard coding ports numbers? It's more likely to cause flaky tests.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I can extract them into the variable if that what you mean, but I can't set it to 0 like in other tests because here I'm testing that restartable fastify starts server on the port I pass.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's probably fine. Maybe use the same port across all of these tests then and make sure they never get run in parallel. A COMMON_PORT variable sounds good.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
README.md
Outdated
|
|
||
| ```js | ||
| import { start } from '@fastify/restartable' | ||
| import { restartable } from './index.js' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| import { restartable } from './index.js' | |
| import { restartable } from '@fastify/restartable' |
5e8649f to
d982948
Compare
d96f60c to
8108e91
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm
No description provided.