Skip to content

arv/replicache-sample-todo

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

59 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Replicache TODO Sample

This repository contains a complete Relicache sample that implements a basic mobile Todo app.

Server

The server is in the serve directory. It's a Zeit Now app in Go.

Persistence is against AWS Aurora (MySQL flavor).

Development

  1. Install zeit now
  2. run now login to get zeit credentials
  3. Get the Rocicorp AWS credentials and put them in (.aws/credentials) on your machine
  4. Add .env file to the root of this repository containing:
    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>
    
    For Rocicorp's internal values, see "passwords" in Google Drive.
  5. Run unit tests with no parallelism go test -p 1 ./.... Note: tests depend on RDS and are therefore flaky.
  6. Run now dev

Deploy

Just commit to origin/master, it is auto-deployed.

Alternately, you can deploy to your own staging environment with:

now deploy

Schema

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.

Client

# 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>' \
  -d '{"id": 1, "listID": 1, "text": "Take out the trash", "complete": true, "order": 0.5}' \
  https://replicache-sample-todo.now.sh/serve/todo-create

# Get current Client View
curl -H 'Authorization: <userid>' https://replicache-sample-todo.now.sh/serve/client-view

About

Sample Replicache integration that implements a Todo service

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Go 100.0%