mirror of
https://github.com/hasura/graphql-engine.git
synced 2024-12-15 01:12:56 +03:00
update docs (#441)
* docs: update custom resolvers docs * docs: update mono repo links
This commit is contained in:
parent
af6121f83d
commit
d2decec32b
2
docs/_theme/djangodocs/layout.html
vendored
2
docs/_theme/djangodocs/layout.html
vendored
@ -117,7 +117,7 @@
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="footer-hasura-custom">
|
<div class="footer-hasura-custom">
|
||||||
Want to contribute or report missing content? Check out the <a target="_blank" href="https://github.com/hasura/graphql-engine-docs">github repo for docs</a>.<br>
|
Want to contribute or report missing content? Check out the <a target="_blank" href="https://github.com/hasura/graphql-engine/tree/master/docs">github repo for docs</a>.<br>
|
||||||
Powered by <a target="_blank" href="http://www.sphinx-doc.org">Sphinx</a>.
|
Powered by <a target="_blank" href="http://www.sphinx-doc.org">Sphinx</a>.
|
||||||
Copyright © 2018 <a target="_blank" href="https://hasura.io">Hasura</a>.
|
Copyright © 2018 <a target="_blank" href="https://hasura.io">Hasura</a>.
|
||||||
</div>
|
</div>
|
||||||
|
@ -10,7 +10,7 @@ Here's a `notification demo app <https://shahidh.in/hasura-web-push-notifs/>`_ s
|
|||||||
notifications using Hasura event triggers and FCM.
|
notifications using Hasura event triggers and FCM.
|
||||||
|
|
||||||
* Video: https://www.youtube.com/watch?v=nuSHkzE2-zo&feature=youtu.be
|
* Video: https://www.youtube.com/watch?v=nuSHkzE2-zo&feature=youtu.be
|
||||||
* Source code: https://github.com/shahidhk/hasura-web-push-notifs
|
* Source code: https://github.com/hasura/graphql-engine/tree/master/community/examples/serverless-push
|
||||||
|
|
||||||
Data Transformations (ETL)
|
Data Transformations (ETL)
|
||||||
^^^^^^^^^^^^^^^^^^^^^^^^^^
|
^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||||
@ -18,4 +18,4 @@ Here's a `serverless ETL demo app <https://shahidh.in/hasura-serverless-etl/>`_
|
|||||||
Algolia search.
|
Algolia search.
|
||||||
|
|
||||||
* Video: https://youtu.be/kWVEBWdEVAA
|
* Video: https://youtu.be/kWVEBWdEVAA
|
||||||
* Source code: https://github.com/shahidhk/hasura-serverless-etl
|
* Source code: https://github.com/hasura/graphql-engine/tree/master/community/examples/serverless-etl
|
||||||
|
@ -18,7 +18,7 @@ Examples
|
|||||||
|
|
||||||
You can find a bunch of examples for various serverless cloud providers in this repo:
|
You can find a bunch of examples for various serverless cloud providers in this repo:
|
||||||
|
|
||||||
https://github.com/hasura/cloud-functions-boilerplates
|
https://github.com/hasura/graphql-engine/tree/master/community/boilerplates/serverless-triggers
|
||||||
|
|
||||||
For example: update related data on a database event
|
For example: update related data on a database event
|
||||||
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||||
@ -28,7 +28,7 @@ note in a separate table.
|
|||||||
|
|
||||||
You can find the complete example at:
|
You can find the complete example at:
|
||||||
|
|
||||||
https://github.com/hasura/cloud-functions-boilerplates/tree/master/aws-lambda/nodejs6/mutation-trigger.
|
https://github.com/hasura/graphql-engine/tree/master/community/boilerplates/serverless-triggers/aws-lambda/nodejs6/mutation.
|
||||||
|
|
||||||
Consider the following simplified schema for the above:
|
Consider the following simplified schema for the above:
|
||||||
|
|
||||||
|
@ -1,3 +1,4 @@
|
|||||||
|
|
||||||
Adding custom GraphQL resolvers
|
Adding custom GraphQL resolvers
|
||||||
===============================
|
===============================
|
||||||
|
|
||||||
@ -5,8 +6,8 @@ Hasura GraphQL engine provides instant GraphQL APIs over the tables and views of
|
|||||||
auto-generating the CRUD resolvers. However, sometimes you might have to write custom resolvers to capture business
|
auto-generating the CRUD resolvers. However, sometimes you might have to write custom resolvers to capture business
|
||||||
logic that is unrelated to the database.
|
logic that is unrelated to the database.
|
||||||
|
|
||||||
We have setup `this boilerplate project <https://github.com/hasura/custom-resolvers-boilerplate>`_ illustrating how to
|
We have setup `this boilerplate project <https://github.com/hasura/graphql-engine/tree/master/community/boilerplates/custom-resolvers>`_
|
||||||
write your own custom GraphQL resolvers and merge them with the Hasura GraphQL engine's resolvers.
|
illustrating how to write your own custom GraphQL resolvers and merge them with the Hasura GraphQL engine's resolvers.
|
||||||
|
|
||||||
Follow the boilerplate's ``README.md`` for detailed instructions.
|
Follow the boilerplate's ``README.md`` for detailed instructions.
|
||||||
|
|
||||||
@ -14,10 +15,10 @@ TL;DR
|
|||||||
-----
|
-----
|
||||||
The boilerplate includes sample custom resolvers for:
|
The boilerplate includes sample custom resolvers for:
|
||||||
|
|
||||||
- A ``hello`` query
|
- A ``hello`` query which returns a fixed string.
|
||||||
- A ``count`` query (that returns a counter from another data source )
|
- A ``count`` query that returns a counter from some other data source.
|
||||||
- A ``increment_counter`` mutation that increments the value of count
|
- A ``increment_counter`` mutation that increments the value of the above counter
|
||||||
- A ``user_average_age`` query that makes directly makes an SQL query to Postgres using Knex
|
- A ``user_average_age`` query that directly makes an SQL query to Postgres using Knex and returns the result
|
||||||
|
|
||||||
The steps to achieve this are:
|
The steps to achieve this are:
|
||||||
|
|
||||||
@ -26,3 +27,5 @@ The steps to achieve this are:
|
|||||||
- Make a new GraphQL schema out of these custom resolvers.
|
- Make a new GraphQL schema out of these custom resolvers.
|
||||||
- Merge this schema with the existing Hasura GraphQL schema and serve the resulting GraphQL API.
|
- Merge this schema with the existing Hasura GraphQL schema and serve the resulting GraphQL API.
|
||||||
|
|
||||||
|
The above steps are implemented using `Apollo's graphql-tools library <https://github.com/apollographql/graphql-tools>`__.
|
||||||
|
|
||||||
|
@ -73,7 +73,7 @@ Now we can use the following subscription to fetch the latest location of a vehi
|
|||||||
|
|
||||||
|
|
||||||
Check this `sample app <https://hasura.github.io/realtime-location-app/>`__ for a working demo
|
Check this `sample app <https://hasura.github.io/realtime-location-app/>`__ for a working demo
|
||||||
(`source code <https://github.com/hasura/realtime-location-app>`__).
|
(`source code <https://github.com/hasura/graphql-engine/tree/master/community/examples/realtime-location-tracking>`__).
|
||||||
|
|
||||||
.. _subscribe_table:
|
.. _subscribe_table:
|
||||||
|
|
||||||
@ -149,7 +149,7 @@ Now we can use the following subscription to display the latest messages in a ch
|
|||||||
}
|
}
|
||||||
|
|
||||||
Check this `sample app <https://chat-example-trial-roar.herokuapp.com/>`__ for a working demo
|
Check this `sample app <https://chat-example-trial-roar.herokuapp.com/>`__ for a working demo
|
||||||
(`source code <https://github.com/wawhal/graphql-subscriptions-chat-app>`__).
|
(`source code <https://github.com/hasura/graphql-engine/tree/master/community/examples/realtime-chat>`__).
|
||||||
|
|
||||||
.. _subscribe_derived:
|
.. _subscribe_derived:
|
||||||
|
|
||||||
@ -281,4 +281,4 @@ Now we can use the following subscription to display the latest poll result:
|
|||||||
}
|
}
|
||||||
|
|
||||||
Check this `sample app <https://shahidh.in/hasura-realtime-poll/>`__ for a working demo
|
Check this `sample app <https://shahidh.in/hasura-realtime-poll/>`__ for a working demo
|
||||||
(`source code <https://github.com/shahidhk/hasura-realtime-poll>`__).
|
(`source code <https://github.com/hasura/graphql-engine/tree/master/community/examples/realtime-poll>`__).
|
||||||
|
Loading…
Reference in New Issue
Block a user