The Apollo Server backend shared by all Apollo client example apps.
Demonstrates:
- GraphQL schema, resolvers, models, and connectors to read from two different data sources, GitHub REST API and SQL
- Web server with authentication and basic authorization using Express, Passport, and Apollo Server
Please submit a pull request if you see anything that can be improved!
- Install Node/npm. Make sure you have Node.js 4 or newer installed.
- Clone and install dependencies. Run the following commands:
git clone https://github.com/apollostack/GitHunt-API.git
cd GitHunt-API
npm install
- Run migrations. Set up the SQLite database and run migrations/seed data with the following commands:
npm run migrate
npm run seed
-
Get GitHub API keys.
-
Go to OAuth applications > Developer applications in GitHub settings
-
Click 'Register a new application' button
-
Register your application like below
-
Click 'Register application' button at the bottom. It should look like this screenshot of the app setup page.
-
On the following page, grab the Client ID and Client Secret, as indicated in this screenshot of the GitHub OAuth keys page.
-
Add Environment Variables. Set your Client ID and Client Secret Environment variables in the terminal like this:
export GITHUB_CLIENT_ID="your Client ID"
export GITHUB_CLIENT_SECRET="your Client Secret"
Or you can use dotenv
, to do this cp .env.default .env
and edit with your Github keys.
- Run the app.
npm start
- Open the app. Open http://localhost:3010/ to see what to do next.