All Projects → anmonteiro → reason-graphql-experiment

anmonteiro / reason-graphql-experiment

Licence: MIT license
Reason + GraphQL Fullstack (Native) experiment with Now 2.0

Programming Languages

javascript
184084 projects - #8 most used programming language
ocaml
1615 projects
HTML
75241 projects

Reason / GraphQL Shared Backend

This is an example of a fullstack Reason + GraphQL application that uses a native backend and a client compiled to JavaScript through BuckleScript, whilst sharing types between the backend and the frontend.

Technologies / Libraries:

This was initially based on @jaredly's isomagic-todos experiment that accomplished sharing types between the backend & frontend through some PPX magic.

In this case, we leverage the power of GraphQL and its support in OCaml through ocaml-graphql-server and graphql_ppx to build our API through shared OCaml / Reason types (have a look in src/shared).

Running

Build the front-end

  • yarn && yarn build

Build and run the backend

  • npm install -g esy
  • esy @server
  • esy @server x graphql

Neat tricks

  • GraphQL schema fully defined in Reason (see src/server/schema.re)
  • There's also a GraphiQL instance at localhost:8080/graphql for exploring and playing with the queries and mutations.

License

MIT

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].