Fix try demo documentation
This commit is contained in:
parent
40fb85c926
commit
dd3132bda0
|
@ -30,6 +30,10 @@ And so after a lot of coffee and some avocado toasts Super Graph was born. An in
|
||||||
- High performance GO codebase
|
- High performance GO codebase
|
||||||
- Tiny docker image and low memory requirements
|
- Tiny docker image and low memory requirements
|
||||||
|
|
||||||
|
## Documentation
|
||||||
|
|
||||||
|
[supergraph.dev](https://supergraph.dev)
|
||||||
|
|
||||||
## Contact me
|
## Contact me
|
||||||
|
|
||||||
[twitter.com/dosco](https://twitter.com/dosco)
|
[twitter.com/dosco](https://twitter.com/dosco)
|
||||||
|
|
|
@ -22,15 +22,20 @@ Without writing a line of code get an instant high-performance GraphQL API for y
|
||||||
## Try it out
|
## Try it out
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
# setup the demo rails app database
|
# download super graph source
|
||||||
docker-compose run web rake db:create db:migrate db:seed
|
git clone https://github.com/dosco/super-graph.git
|
||||||
|
|
||||||
# run the demo rails app and the Super Graph service
|
# setup the demo rails app & database
|
||||||
docker-compose -f docker-compose.image.yml up
|
./demo setup
|
||||||
|
|
||||||
# try out the GraphQL api with the web ui in your browser
|
# run the demo
|
||||||
|
./demo run
|
||||||
|
|
||||||
|
# signin to the demo app (user1@demo.com / 123456)
|
||||||
|
open http://localhost:3000
|
||||||
|
|
||||||
|
# try the super graph web ui
|
||||||
open http://localhost:8080
|
open http://localhost:8080
|
||||||
|
|
||||||
```
|
```
|
||||||
|
|
||||||
## Try this GraphQL query
|
## Try this GraphQL query
|
||||||
|
|
|
@ -18,6 +18,32 @@ Without writing a line of code get an instant high-performance GraphQL API for y
|
||||||
- High performance GO codebase
|
- High performance GO codebase
|
||||||
- Tiny docker image and low memory requirements
|
- Tiny docker image and low memory requirements
|
||||||
|
|
||||||
|
## Try it out
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# download super graph source
|
||||||
|
git clone https://github.com/dosco/super-graph.git
|
||||||
|
|
||||||
|
# setup the demo rails app & database
|
||||||
|
./demo setup
|
||||||
|
|
||||||
|
# run the demo
|
||||||
|
./demo run
|
||||||
|
|
||||||
|
# signin to the demo app (user1@demo.com / 123456)
|
||||||
|
open http://localhost:3000
|
||||||
|
|
||||||
|
# try the super graph web ui
|
||||||
|
open http://localhost:8080
|
||||||
|
```
|
||||||
|
|
||||||
|
::: warning DEMO REQUIREMENTS
|
||||||
|
This demo requires `docker` you can either install it using `brew` or from the
|
||||||
|
docker website https://docs.docker.com/docker-for-mac/install/
|
||||||
|
:::
|
||||||
|
|
||||||
|
#### Trying out GraphQL
|
||||||
|
|
||||||
We currently support the `query` action which is used for fetching data. Support for `mutation` and `subscriptions` is work in progress. For example the below GraphQL query would fetch two products that belong to the current user where the price is greater than 10
|
We currently support the `query` action which is used for fetching data. Support for `mutation` and `subscriptions` is work in progress. For example the below GraphQL query would fetch two products that belong to the current user where the price is greater than 10
|
||||||
|
|
||||||
#### GQL Query
|
#### GQL Query
|
||||||
|
@ -71,26 +97,6 @@ For example there is a while greater than `gt` and a limit clause on a child fie
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
The above command will download the latest docker image for Super Graph and use it to run an example that includes a Postgres DB and a simple Rails ecommerce store app.
|
|
||||||
|
|
||||||
If you want to build and run Super Graph from code then the below commands will build the web ui and launch Super Graph in developer mode with a watcher to rebuild on code changes.
|
|
||||||
|
|
||||||
```bash
|
|
||||||
|
|
||||||
# yarn is needed to build the web ui
|
|
||||||
brew install yarn
|
|
||||||
|
|
||||||
# yarn install dependencies and build the web ui
|
|
||||||
(cd web && yarn install && yarn build)
|
|
||||||
|
|
||||||
# generate some stuff the go code needs
|
|
||||||
go generate ./...
|
|
||||||
|
|
||||||
# start super graph in development mode with a change watcher
|
|
||||||
docker-compose up
|
|
||||||
|
|
||||||
```
|
|
||||||
|
|
||||||
#### Try with an authenticated user
|
#### Try with an authenticated user
|
||||||
|
|
||||||
In development mode you can use the `X-User-ID: 4` header to set a user id so you don't have to worries about cookies etc. This can be set using the *HTTP Headers* tab at the bottom of the web UI you'll see when you visit the above link. You can also directly run queries from the commandline like below.
|
In development mode you can use the `X-User-ID: 4` header to set a user id so you don't have to worries about cookies etc. This can be set using the *HTTP Headers* tab at the bottom of the web UI you'll see when you visit the above link. You can also directly run queries from the commandline like below.
|
||||||
|
@ -558,6 +564,30 @@ If your Rails app runs on Kubernetes then ensure you have an ingress config depl
|
||||||
### JWT tokens (Auth0, etc)
|
### JWT tokens (Auth0, etc)
|
||||||
In that case deploy under a subdomain and configure this service to use JWT authentication. You will need the public key file or secret key. Ensure your web app passes the JWT token with every GQL request in the Authorize header as a `bearer` token.
|
In that case deploy under a subdomain and configure this service to use JWT authentication. You will need the public key file or secret key. Ensure your web app passes the JWT token with every GQL request in the Authorize header as a `bearer` token.
|
||||||
|
|
||||||
|
## Developing Super Graph
|
||||||
|
|
||||||
|
If you want to build and run Super Graph from code then the below commands will build the web ui and launch Super Graph in developer mode with a watcher to rebuild on code changes. And the demo rails app is also launched to make it essier to test changes.
|
||||||
|
|
||||||
|
```bash
|
||||||
|
|
||||||
|
# yarn is needed to build the web ui
|
||||||
|
brew install yarn
|
||||||
|
|
||||||
|
# yarn install dependencies and build the web ui
|
||||||
|
(cd web && yarn install && yarn build)
|
||||||
|
|
||||||
|
# generate some stuff the go code needs
|
||||||
|
go generate ./...
|
||||||
|
|
||||||
|
# do this the only the time to setup the database
|
||||||
|
docker-compose run web rake db:create db:migrate
|
||||||
|
|
||||||
|
# start super graph in development mode with a change watcher
|
||||||
|
docker-compose up
|
||||||
|
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
## MIT License
|
## MIT License
|
||||||
|
|
||||||
MIT Licensed | Copyright © 2018-present Vikram Rangnekar
|
MIT Licensed | Copyright © 2018-present Vikram Rangnekar
|
|
@ -1,24 +0,0 @@
|
||||||
# README
|
|
||||||
|
|
||||||
This README would normally document whatever steps are necessary to get the
|
|
||||||
application up and running.
|
|
||||||
|
|
||||||
Things you may want to cover:
|
|
||||||
|
|
||||||
* Ruby version
|
|
||||||
|
|
||||||
* System dependencies
|
|
||||||
|
|
||||||
* Configuration
|
|
||||||
|
|
||||||
* Database creation
|
|
||||||
|
|
||||||
* Database initialization
|
|
||||||
|
|
||||||
* How to run the test suite
|
|
||||||
|
|
||||||
* Services (job queues, cache servers, search engines, etc.)
|
|
||||||
|
|
||||||
* Deployment instructions
|
|
||||||
|
|
||||||
* ...
|
|
Loading…
Reference in New Issue