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

feat: add http health API #763

Merged
merged 4 commits into from May 11, 2022
Merged

feat: add http health API #763

merged 4 commits into from May 11, 2022

Conversation

niklasad1
Copy link
Member

No description provided.

@niklasad1 niklasad1 requested a review from a team as a code owner May 11, 2022 08:00
http-server/src/server.rs Outdated Show resolved Hide resolved
Copy link
Contributor

@dvdplm dvdplm left a comment

Choose a reason for hiding this comment

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

❤️

@dvdplm dvdplm merged commit 734196f into master May 11, 2022
@dvdplm dvdplm deleted the na-health-api branch May 11, 2022 08:53
Comment on lines +172 to +178
/// Enable health endpoint.
/// Allows you to expose one of the methods under GET /<path> The method will be invoked with no parameters. Error returned from the method will be converted to status 500 response.
/// Expects a tuple with (<path>, <rpc-method-name>).
pub fn health_api(mut self, path: impl Into<String>, method: impl Into<String>) -> Self {
self.health_api = Some(HealthApi { path: path.into(), method: method.into() });
self
}
Copy link
Member

Choose a reason for hiding this comment

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

The docs are rather confusing. I needed to read the code to fully understand on what this is doing.

And why is the method called health_api? Couldn't this theoretically be any kind of endpoint? (which is already implicitly supported, because path can be anything)

Copy link
Member Author

@niklasad1 niklasad1 May 11, 2022

Choose a reason for hiding this comment

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

yepp, you are correct.

I did the fastest possible way and did the same as the jsonrpc crate does.

Sure let's open an issue and do something better.

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.

None yet

5 participants