Rust ToDo is a REST API for task management written in Rust and using PostgresSQL as a backend.
All data is sent and received as JSON. All responses (aside from is_alive) additionally include a request_id key which uniquely identifies the request.
- /logout: Disable an auth key
- Input keys:
- auth_key [string]: An auth key as returned by the login endpoint.
- Input keys:
- /is_alive: unconditionally returns an Ok status
- /task_by_id: Retrieve the contents of a task based on its ID
- Input keys:
- auth_key [string]: An auth key as returned by the login endpoint.
- id [number]: The id of the task to retrieve.
- Output keys:
- task [object]: An object that can be deserialized by
Task::from_json_object.
- task [object]: An object that can be deserialized by
- Input keys:
- /whoami: Retrieves the username of the currently logged in user
- Input keys:
- auth_key [string]: An auth key as returned by the login endpoint.
- Output keys:
- username [string]: The name of the user associated with the auth_key
- Input keys:
- /register_account: Creates a new account for future use.
- Input keys:
- username [string]: The username for the new account. Must not already exist.
- password [string]: The password for the new account.
- Input keys:
- /login: Generates a new auth key which can be used in future requests.
- Input keys:
- username [string]: The username to log in with.
- password [string]: The password associated with the user
- Output keys:
- auth_key [string]: The auth_key which can be used for requests that require authentication
- Input keys:
- /add_task: Creates a new task
- Input keys:
- auth_key [string]: An auth key as returned by the login endpoint.
- title [string]: The title of the new task (should be short)
- description [string] (optional): A description of the task (could be long)
- Output keys:
- id [number]: A unique identifier for the task.
- Input keys:
- /task_by_id: Changes some or all of the data contained in a task.
- Input keys:
- auth_key [string]: An auth key as returned by the login endpoint.
- id [number]: The id of the task to change.
- completed [bool] (optional): The new completed status of the task.
- title [string] (optional): The new title of the task.
- description [string] (optional): The new description of the task.
- Input keys:
- .github/workflows/main.yml:
- CI tests
- http_requests/*:
- Raw HTTP requests useful for manually testing features against a running server
- migrations/*:
- Database migrations for use with Diesel
- scripts
- run_from_container.sh:
- Helper script to run the application from inside a Docker container
- run_test_database.sh:
- Runs a PostgresSQL database in a docker container with username "postgres" and password "test-password"
- Creates the todo table
- run_from_container.sh:
- src
- core.rs
- Core application logic for task management; notably, this contains all of the database logic.
- domain_types.rs
- Contains data types which have application-specific logic attached, such as validation on construction or zeroization on drop.
- lib.rs
- Entry point for library code
- main.rs
- Entry point for running the server
- schema.rs
- Generated by Diesel, contains support definitions that map the database schema to rust types
- web_api.rs
- Contains HTTP-specific logic, such as defining endpoints and returning appropriate status codes
- core.rs