Skip to content

A simple server to have a GraphiQL UI playground for your API, it handles authentication and proxies all API calls (avoiding CORS)

License

Notifications You must be signed in to change notification settings

digitalnatives/graphiql-server

Repository files navigation

GraphiQL Server Build Status

A simple server to have a GraphiQL UI playground for your API, it handles authentication and proxies all API calls (avoiding CORS)

logged-in logged-out

Deploy

Deploy

We make it easy to deploy as a free Heroku app.

Just press the button above and fill in the following environment variables:

GS_APP_URL: https://<heroku-app-name>.herokuapp.com

The <heroku-app-name> is the name that you choose for your app on Heroku.

This will be the base Url for the callback on the OAuth2 auth flow.

If you want to use your own domain, you can add it here or change it latter on app settings tab.

GS_SESSION_SECRET: This is the secret used to sign the session ID cookie, used by express-session.

GS_GRAPHQL_URL: Your GraphQL endpoint.

GS_OAUTH2_AUTHORIZATION_URL: Your OAuth2 authorization endpoint.

GS_OAUTH2_TOKEN_URL: Your OAuth2 token endpoint.

GS_OAUTH2_CLIENT_ID: Your OAuth2 client ID.

GS_OAUTH2_CLIENT_SECRET: Your OAuth2 client secret.

Running locally

For both methods you need to have the environment variables configured, see the .envrc.sample file for more info.

With Node

Install Node and run:

npm install
npm start

With Docker

Install Docker and run:

docker-compose up app
# the first time it can take some time depending on your internet connection

Features

  • Supports only OAuth2 authentication flow now. (We need your help to make it better and add more :)
  • Proxy all the GraphQL API calls through the server, this way the tokens only live on the server side and it's possible to use API's without CORS enabled.

To do's

  • Add support for others authentication methods.
  • Any idea? Open an issue and let's talk :)

Contributing

  1. Fork it!
  2. Create your feature branch: git checkout -b my-new-feature
  3. Commit your changes: git commit -m 'Add some feature'
  4. Push to the branch: git push origin my-new-feature
  5. Submit a pull request :D

History

See Releases for detailed changelog.

License

MIT License © Digital Natives

About

A simple server to have a GraphiQL UI playground for your API, it handles authentication and proxies all API calls (avoiding CORS)

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published