Trying axum and shuttle. Spoiler: they are both epic.
This site has three endpoints:
Gives definitions for given words using Merriam Webster
A randomly generated image for avatars etc. Each username has a custom random image
Calculate the determinant of a matrix using a CAS
Run locally with cargo run
. To deploy change the project id in Shuttle.toml
then run cargo shuttle deploy
.
Firstly this projects still compiles without the api key just any /define/:word
endpoints will return a NoApiKey
error.
However you can add a api key from Merriam Webster's api to enable the endpoint.
- To use locally (
cargo run
) the program pulls from an environment variable namedMERRIAM_WEBSTER_API_KEY
- When deploying on shuttle the program pulls from a postgres database on shuttle. It is currently a little bit complicated but you need to:
- Deploy initially to create the database on shuttle
- run
psql *db url it gives you*
(the db url includes a password per deployment) - in
psql
run:CREATE TABLE Secrets ( name VARCHAR PRIMARY KEY, key VARCHAR );
INSERT INTO Secrets (name, key) VALUES ( 'MERRIAM_WEBSTER_API_KEY', '*your api key*' );