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

GraphQL Layer #2

Open
ben-pr-p opened this issue Apr 10, 2018 · 1 comment
Open

GraphQL Layer #2

ben-pr-p opened this issue Apr 10, 2018 · 1 comment

Comments

@ben-pr-p
Copy link
Contributor

ben-pr-p commented Apr 10, 2018

Since we have .one(), .findAll(), .edit(), and .delete() implemented for the resources we expose, it should be possible to write another layer that exposes a GraphQL API using the same adaptor code.

To do that, one would add another express application here: https://github.com/justicedemocrats/osdi-proxy/blob/master/index.js#L31

Something like

app.use(${config.route}/gqp, gqlApp(config.crud(config), config));

and then write the gqlApp function.

The difficult part is that the schema must be generated dynamically, since not all of the adaptors support all of the same resources. See https://github.com/justicedemocrats/osdi-proxy/blob/master/config/adaptors/ak.js#L15 vs https://github.com/justicedemocrats/osdi-proxy/blob/master/config/adaptors/bsd.js#L13 for example – I haven't implemented the List API on top of BSD yet

@fkautz
Copy link

fkautz commented Apr 12, 2018

For the schema, use https://github.com/apollographql/graphql-tools/blob/master/docs/source/generate-schema.md

Build out each section in a modular way, and use the extend keyword to inject new entities into the schema at start time.

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

No branches or pull requests

2 participants