API for personal data storage.
- Clone this repo
cd
into my-data- Copy .env.template to .env
- Create a postgres database for the API to use. See the directory called
db-postgresql-docker
in this repo to easily spin up a postgres database. - Set database variables in .env
- Install Diesel CLI (ORM to interact with the database):
cargo install diesel_cli --no-default-features --features postgres
- Apply the migrations available in the 'migrations' directory:
diesel migration run
Ensure that all schemas are imported to the schema file. By default Diesel uses the public schema to generate the schema file. Until Diesel updates their cli to support multiple schemas (there is a ticket open on GitHub atm - splitting into multiple schema.rs), you will have to manually generate the other schemas by using the print-schema
command. For example, to add the financial schema, run the following command:
diesel print-schema -s financial >> src/schema.rs
- Set the API_HOST, API_PORT, and SECRET_TOKEN in .env
- Run the server:
cargo run