11 releases

0.2.8 Jul 8, 2024
0.2.7 Jul 8, 2024
0.1.4 Jun 19, 2024

#43 in HTTP server

Download history 9/week @ 2024-09-11 12/week @ 2024-09-18 30/week @ 2024-09-25

418 downloads per month

Apache-2.0

54KB
1K SLoC

GoalAim Backend

Linux Rust

Table of Contents

Presentation

Here the repo of the Rust server.
The application will make call to the server to get the information.

Installation

Local db

You have to setup a local postgres db with docker :

# Install diesel
cargo install diesel_cli --no-default-features --features postgres

# creation du docker:
sudo docker run --name goalaim_db -d -p 5432:5432 -e POSTGRES_PASSWORD=admin postgres

# CMD for the end
# Connect yourself to the docker :
psql --host=0.0.0.0 -U postgres

# Always restart the docker :
sudo docker update --restart always goalaim_db

# In the docker :
CREATE DATABASE goalaim_db;
CREATE DATABASE test_db;

# In the .env at the root of the project
DATABASE_TEST_URL=postgres://postgres:admin@0.0.0.0/test_db
DATABASE_URL=postgres://postgres:admin@0.0.0.0/goalaim_db
PORT=8080
JWT_SECRET="celui qui lit ça est gay"

For Diesel set this in your .bashrc or .zshrc and then, restart your terminal

# relace user by the real name
export PATH="$PATH:/home/user/.cargo/bin"

To create the Table in the docker psql :

diesel migration run

To check if the table is created :

# Connection
psql --host=0.0.0.0 -U postgres

# Connect yourself to the db
\connect goalaim_db

# Check if table exist
SELECT * FROM users;

Launch server

To launch the server run :

cargo build

# or directly
cargo run

Unit Tests

To run the unit tests :

cargo test

Documentations

To have the Documentation of the code :

cargo doc

Now you have to go to ${ACTUAL_PATH}/target/doc/goalaim/ and open the index.html in the browser.

Swagger

You can have the swagger of our API routes in Swagger

You can have a preview of our swagger with the Swagger Preview extension in vscode.

Contributors

You can contact us at:

Noeme Suisse
Noeme Suisse

vic
Victor Massonnat

Dependencies

~22–37MB
~649K SLoC