Please note: This project is no longer maintained. For an up to date example of modern day Apollo usage, please refer to the Apollo fullstack tutorial.
The Apollo Server backend shared by all Apollo client example apps.
Interact with the API yourself at http://api.githunt.com/graphiql.
- 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!
Running the server
- 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 run dev
- Open the app. Open http://localhost:3010/ to see what to do next.