- Valentin DOREAU
- Kilian GOËTZ
- Osee Brayan TCHAPPI
The documentation is accessible at the /doc route when running the API.
You can get the openapi.json file from this page.
Docker is the easiest way to develop, it doesn't require any dependence.
You can start the project using the following command. It may take some time the first time.
docker-compose up -dThe application is recompiled automatically on each file modification.
Install Rust here.
You'll need two environment variables to start:
DATABASE_URL: connection string to a working PostgreSQL database of the formpostgres://<user>:<password>@<host>/<database>JWT_SECRET: for development, you can set any value
Finally, run cargo run to start the server.
It is highly encouraged to take example on other pieces of code and understand the different parts and how they interact together.
This is written in Rust, as a general rule of thumbs, if it compiles, it mostly works.
- Run
diesel migration generate create_<table>to create the migrations - Complete the newly created
up.sqlanddown.sql - Create a file named after your model in
src/models/ - This file should contain a normal, updating and new
struct(eg.Skill,UpdatingSkill,NewSkill). The fields should be in the same order as in the sql definition.
Here are the usual derive for each struct, use your common sense to determine if they need others.
struct |
derive |
|---|---|
| normal | Serialize, Queryable, ToSchema |
| updating | Deserialize, AsChangeset, ToSchema |
| new | Deserialize, Insertable, ToSchema, IntoParams |
Once the model is created, create a file in src/routes/ with the same name as the model.
- Create a
routesfunction that returns aScope, this will be to register the routes in this file. - Add one function per route, add the correct macro from actix. Also add the
pathmacro from utoipa to generate documentation - Create a
<type>Docstructthat references the different routes and responsestruct, this is to generate the OpenApi documentation - Add this
structto thedocfunction insrc/documentation