This repository contains a complete Relicache sample that implements a basic mobile Todo app.
The server is in the serve
directory. It's a Zeit Now app in Go.
Persistence is against AWS Aurora (MySQL flavor).
- Install zeit now
- run
now login
to get zeit credentials - Get the Rocicorp AWS credentials and put them in (.aws/credentials) on your machine
- Add
.env
file to the root of this repository containing:For Rocicorp's internal values, see "passwords" in Google Drive.REPLICANT_AWS_ACCESS_KEY_ID=<access key from .aws/credentials> REPLICANT_AWS_SECRET_ACCESS_KEY=<secret access key from .aws/credentials> REPLICANT_SAMPLE_TODO_ENV=dev_<your Rocicorp username> FCM_SERVER_KEY=<Firebase Cloud Messaging Server Key>
- Run unit tests with no parallelism
go test -p 1 ./...
. Note: tests depend on RDS and are therefore flaky. - Run
now dev
Just commit to origin/master, it is auto-deployed.
Alternately, you can deploy to your own staging environment with:
now deploy
The schema we run against is managed in schema.go
. Whenever it is changed, the db is dropped and re-created.
We don't currently attempt to migrate data between versions.
# Login
curl -d '{"email":"foo@bar.com"}' https://replicache-sample-todo.now.sh/serve/login
# Create a TODO
# If the List ID is unknown, it is implicity created.
curl -H 'Authorization: <userid>' -H "Content-type: application/json" \
-d '{"id": 1, "listID": 1, "text": "Take out the trash", "complete": true, "order": "a0"}' \
https://replicache-sample-todo.now.sh/serve/todo-create
# Get current Client View
curl -X POST -d '{"clientID":"12345"}' -H "Content-type: application/json"\
-H "Authorization: <userid>" https://replicache-sample-todo.now.sh/serve/replicache-client-view