graphql-framework-experiment icon indicating copy to clipboard operation
graphql-framework-experiment copied to clipboard

Server System

Open jasonkuhrt opened this issue 5 years ago • 3 comments

What

  • Define a server middleware API
  • Do not re-export another server middleware system
  • Do be open to adaptors that permit bridging with middleware from other frameworks
  • There must be a standard interface, contract, for plugins to write their logic against
  • Do not expose the raw underlying server API to the app
  • Do consider an unsafe raw escape hatch so apps can get access to the underlying server API
  • Maybe the server implementation is adapted to the deployment target, e.g. serverless uses something else than long-lived etc.
  • Can we ignore router for now?
  • Focus on Middleware focused on header and context manipulation, with ability to short circuit

Related

#141 #270 #231 #273 #506

jasonkuhrt avatar Jan 16 '20 20:01 jasonkuhrt

We have made some progress on this topic.

  • server should work with graphqljs directly
  • server should be built on top of node http, not express
  • server should have own middleware system
  • server middleware system should have access to the same context resolvers will get and/or schema.addToContext has an api to add context scope to a request without permitting its use as a middleware standin
  • nexus should have a serverless mode, meaning it just exports a request handler that the host platform will call

Links

Combine v8 snapshots + AWS Lambda

  • https://docs.aws.amazon.com/lambda/latest/dg/runtimes-custom.html
  • https://nodejs.org/api/v8.html
  • http://peterforgacs.github.io/2018/09/12/How-to-create-a-V8-snapshot-of-your-javascript-file/
  • https://stackoverflow.com/questions/11109538/node-js-v8-how-to-make-my-own-snapshot-to-accelerate-startup
  • https://github.com/nodejs/node/pull/28181
  • https://helpdev.eu/node-js-12-5-shortened-startup-time-with-v8-snapshots/

jasonkuhrt avatar Mar 20 '20 18:03 jasonkuhrt

Hi, I love nexus and was wondering the prgress/eta of the feature? Is there anyway I can assist in testing or exploration? @jasonkuhrt

Thanks for all your work!

Oba-One avatar Jul 12 '20 19:07 Oba-One

I'm definitely interested in your progress with this -- custom runtimes with V8 Snapshots sounds like a huge win (but also sounds like something the AWS Lambda team easily can and probably should do on their own, considering end users are not charged for init time)

russell-dot-js avatar Jul 30 '20 21:07 russell-dot-js