Skip to content

Conversation

armanbilge
Copy link
Member

@armanbilge armanbilge commented May 18, 2022

This is a necessary preliminary to publishing a client testkit #5320 which is a necessary preliminary to schisming the client backends.

Changes in this PR:

  1. Move Node.js interop stuff into core module under org.http4s.nodejs package.

  2. Refactor the JS scaffold server to use that ☝️

  3. Remove the unpublished node-serverless module.

  4. Implement a NodeJSClient analog to the JavaNetClient: a dependency-free, non-production-grade client. This also provides us an independent way to test the scaffold server and Node.js interop. Previously these were tested implicitly while actually testing ember-client.js.

    Correctly implementing the NodeJSClient was annoyingly hard because of crappy Node.js APIs. So I'm glad we have ember on JS instead.

@armanbilge armanbilge changed the title JS refactoring in preparation for client schism JS refactoring in preparation for client backend schism May 18, 2022
Comment on lines +37 to +38
* This client is currently not production grade, but convenient for
* experimentation and exploration.
Copy link
Member Author

Choose a reason for hiding this comment

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

In theory, this could be a very good client (like the jdk-http-client) if someone put in the work to make it robust and expose the configuration options.

Copy link
Member Author

Choose a reason for hiding this comment

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

Also FTR, I wouldn't be opposed to keeping this http4s private or just dumping it altogether. It's useful for testing, but dealing with JS APIs is fiddly and I don't want it to become a maintenance burden on the core team especially when the whole point of the schism is to reduce said burden.

I don't expect it to break (the underlying Node.js APIs are stable) but it might require additional work if/when the ClientRouteTestBattery gets more tests.

Copy link
Member

Choose a reason for hiding this comment

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

Is it useful in a REPL? That's the other place that the Java 8 one comes in handy.

Copy link
Member Author

Choose a reason for hiding this comment

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

No, because there is no Scala.js REPL. This is on scala-cli's radar but seems unlikely.

Copy link
Member

Choose a reason for hiding this comment

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

It's always easier to make something public than take it away. If you have any doubts, I'd make it private.

@@ -67,7 +67,6 @@ lazy val modules: List[CompositeProject] = List(
asyncHttpClient,
jettyClient,
okHttpClient,
nodeServerless,
Copy link
Member Author

Choose a reason for hiding this comment

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

The node-serverless module provided:

  1. Converters to/from the Node.js HTTP models. These have now moved to core.
  2. Helpers for exporting HttpApps as JS "listener" functions, commonly used in serverless frameworks. These will find a better home in https://github.com/typelevel/feral.

I never published this module in 0.23 because I was skeptical of the API, but it was useful internally to implement the server scaffold on JS.

Copy link
Member

@rossabaker rossabaker left a comment

Choose a reason for hiding this comment

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

The JavaScript ecosystem still bewilders me, but I don't see anything troublesome here. I trust @armanbilge to decide whether to keep that new client public or private.

Comment on lines +37 to +38
* This client is currently not production grade, but convenient for
* experimentation and exploration.
Copy link
Member

Choose a reason for hiding this comment

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

It's always easier to make something public than take it away. If you have any doubts, I'd make it private.

@armanbilge armanbilge merged commit 8d25800 into http4s:series/0.23 May 19, 2022
@rossabaker rossabaker added the behind-the-scenes Appreciated, but not user-facing label May 24, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
behind-the-scenes Appreciated, but not user-facing module:client module:core series/0.23 PRs targeting 0.23.x
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants