Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@ivan-tymoshenko
Copy link
Member

No description provided.

Copy link
Member

@mcollina mcollina left a 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 })
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
const app = await restartable(createApp, fastify, { logger: true })
const app = await restartable(createApp, { logger: true })

I think this API would be better

Copy link
Member Author

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.

teardown(stop)

const { address, port } = await listen()
const host = await app.listen({ host: '127.0.0.1', port: 5844 })
Copy link

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.

Copy link
Member Author

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.

Copy link

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.

Copy link
Member Author

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'
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
import { restartable } from './index.js'
import { restartable } from '@fastify/restartable'

@ivan-tymoshenko ivan-tymoshenko force-pushed the update-restartable-api branch from 5e8649f to d982948 Compare May 3, 2023 14:10
@ivan-tymoshenko ivan-tymoshenko force-pushed the update-restartable-api branch from d96f60c to 8108e91 Compare May 3, 2023 14:19
Copy link
Member

@mcollina mcollina left a comment

Choose a reason for hiding this comment

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

lgtm

@mcollina mcollina merged commit 4e9fc3c into main May 5, 2023
@mcollina mcollina deleted the update-restartable-api branch May 5, 2023 12:31
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.

4 participants