A new backend for graphql.natwelch.com.
The next iteration in Nat's content management system. Previous versions include:
This repo requires Go 1.11 to be installed.
- Start postgres on your local machine with a database called writing.
- Copy
local.env
to.env
env $(cat .env) go run -v ./server
to start the server.- Visit http://localhost:8080/ which has a default graphql client.
DATABASE_URL=postgres://localhost/writing?sslmode=disable&binary_parameters=yes
SESSION_SECRET="random string"
OAUTH2_CLIENTID=something.apps.googleusercontent.com
OAUTH2_SECRET=1234567890
OAUTH2_REDIRECT=http://localhost:8080/callback
PORT=9393
This uses Auth0 to generate logins. To save yourself setting up the Auth0, you can generate an API key for testing by creating a user. To create a user for testing, run the following insert SQL:
INSERT INTO users (id, role, created_at, modified_at) VALUES ('test', 'admin', now(), now());
Then get your API key:
SELECT apikey from users where id = 'test';
And then set that as the value of the X-API-AUTH
on all of your requests to graphql.
This site is hosted at https://graphql.natwelch.com. It runs out of a docker container on Google Kubernetes. It has a postgres backend. This started as a rewrite of a previous project, natnatnat. Its readme walks through a lot of the previous inspiration.
We use https://github.com/99designs/gqlgen to generate a lot of the files.
- For schema docs, https://graphql.natwelch.com.
- For
*.graphql
files. See https://facebook.github.io/graphql/June2018/#sec-Descriptions for an explanation of the description schema. - For Go, see https://godoc.org/github.com/icco/graphql