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

gRPC -> HTTP express #50

Merged
merged 7 commits into from
Mar 19, 2024
Merged

gRPC -> HTTP express #50

merged 7 commits into from
Mar 19, 2024

Conversation

jowparks
Copy link
Contributor

@jowparks jowparks commented Mar 15, 2024

Converts from gRPC server to standard HTTP REST.

  • For ease of use, current code returns JSON response type (or hex encoded bytearray for blocks) and is available when running server at http://localhost:3000/docs
  • Adds OpenAPI autogeneated specification in src/swagger/swagger.json (generated via yarn tsoa-gen)
  • Example client uses this service, creates client code via yarn swagger-typescript-api -p ../src/swagger/swagger.json -o src/api
  • Updates Tests
  • Updates Dockerfile
  • Protobuf now contains all hex string for serialized data rather than bytes (as used with protobuf).

@@ -0,0 +1,308 @@
/* tslint:disable */
Copy link
Contributor Author

Choose a reason for hiding this comment

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

auto-generated.

@@ -0,0 +1,364 @@
{
Copy link
Contributor Author

Choose a reason for hiding this comment

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

autogenerated

@@ -0,0 +1,14 @@
2024/03/15-10:34:36.319668 170dff000 Recovering log #68
2024/03/15-10:34:36.320212 170dff000 Level-0 table #70: started
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Added prepopulated test db with 10 records so running cache against server isn't required.

Changes:

cleanup

add tests

add tsoa for openapi generation

update example client

typing and bug fixes
@@ -51,11 +49,16 @@
"ts-node": "10.9.1",
"ts-proto": "1.155.1",
"tsc-alias": "^1.8.7",
"typescript": "5.1.6",
"vitest": "^0.34.1"
Copy link
Member

Choose a reason for hiding this comment

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

What was the issue with vitest?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I remember I ran into an issue when porting these endpoints, unfortunately I forgot what it was 😅 I thought "What is vitest getting for us"? So I just replaced with standard jest since we aren't doing anything special in this repo.

@jowparks jowparks requested a review from dguenther March 19, 2024 16:03
@jowparks jowparks merged commit ff7ff2d into main Mar 19, 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.

2 participants