Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/23andme/api-example-go

An example API app in Go that tests a user's WNT16 and FAM3C genes for unbreakable bones.
https://github.com/23andme/api-example-go

Last synced: 3 months ago
JSON representation

An example API app in Go that tests a user's WNT16 and FAM3C genes for unbreakable bones.

Awesome Lists containing this project

README

        

api-example-bones
=================

An example API app in Go that checks a user's WNT16 and FAM3C genes for unbreakable bones.
Clone the repository, and look at the ```.env``` file to see what environment variables must be set.

Your env's ```REDIRECT_URI``` must match the one on your developer dashboard at https://api.23andme.com/dashboard/. Locally you'll probably want ```http://localhost:PORT/receive_code/```.

Heroku
===
I host the app on Heroku.
- Setup Go on Heroku: http://mmcgrana.github.com/2012/09/getting-started-with-go-on-heroku.html.
- Set environment variables on Heroku: https://devcenter.heroku.com/articles/config-vars.

I change ```CLIENT_ID``` and ```CLIENT_SECRET``` to match my API credentials, and delete the ```PORT``` variable because Heroku sets it automatically.

```
heroku config:set CLIENT_ID=xxx
heroku config:set CLIENT_SECRET=xxx
heroku config:set COOKIE_SECRET=xxx
heroku config:set SESSION_NAME=api-example-bones
heroku config:set SESSION_ACCESS_TOKEN_KEY=xxx
heroku config:set REDIRECT_URI=http://yourapp.com/receive_code/
heroku config:unset PORT
```

Local
===

Just set your environment variables, build the program, and run it:

```go
go build
./api-example-bones
```