2024-10-23 17:15:11 +00:00
|
|
|
# NixiN Farm Loco POC
|
2024-10-23 17:15:51 +00:00
|
|
|
This project is an experiment to evaluate the [loco-rs framework](https://loco.rs/docs)
|
2024-10-16 17:58:24 +00:00
|
|
|
|
|
|
|
## Dev environment
|
|
|
|
## Install Rust
|
2024-10-23 17:19:47 +00:00
|
|
|
If you are on NixOS, there is a shell.nix at the root of the project. You just have to run `nix-shell` to get a rust environment
|
|
|
|
Otherwise, go to https://www.rust-lang.org/tools/install for instructions to install Rust
|
|
|
|
You will also need the open ssl development library (`apt install libssl-dev` on debian/ubuntu)
|
2024-10-23 17:13:54 +00:00
|
|
|
|
2024-10-16 17:58:24 +00:00
|
|
|
# Install Loco
|
2024-10-21 21:21:26 +00:00
|
|
|
```sh
|
2024-10-16 17:58:24 +00:00
|
|
|
$ cargo install loco-cli
|
|
|
|
$ cargo install sea-orm-cli
|
|
|
|
```
|
2024-10-23 17:13:54 +00:00
|
|
|
# Run a sub project for test/debug
|
2024-10-23 17:19:47 +00:00
|
|
|
change directory to one sub-project and run it using `cargo loco start`. For exemple :
|
2024-10-21 21:21:26 +00:00
|
|
|
```sh
|
2024-10-23 17:13:54 +00:00
|
|
|
$ cd nixin_farm_ssr
|
|
|
|
$ cargo loco start
|
2024-10-21 21:21:26 +00:00
|
|
|
```
|
2024-10-22 12:03:51 +00:00
|
|
|
# Test / Debug
|
2024-10-23 17:13:54 +00:00
|
|
|
To test the app with a web browser point it to http://localhost:5150
|
|
|
|
|
2024-10-22 12:03:51 +00:00
|
|
|
To register a user from the command line :
|
|
|
|
```sh
|
|
|
|
curl --location 'localhost:5150/api/auth/register'
|
|
|
|
--header 'Content-Type: application/json'
|
|
|
|
--data-raw '{
|
|
|
|
"name": "test",
|
|
|
|
"email": "test@nixin.local",
|
|
|
|
"password": "Test"
|
|
|
|
}'
|
|
|
|
```
|
|
|
|
|
|
|
|
To test user login from the command line :
|
|
|
|
```sh
|
|
|
|
curl --location 'localhost:5150/api/auth/login' \
|
|
|
|
--header 'Content-Type: application/json' \
|
|
|
|
--data-raw '{
|
|
|
|
"email": "test@nixin.local",
|
|
|
|
"password": "Test"
|
|
|
|
}'
|
|
|
|
```
|
|
|
|
|
2024-10-23 17:13:54 +00:00
|
|
|
# Update loco
|
|
|
|
To update loco-rs Use `cargo interactive-update` to update all dependencies. Do not forget to also do it inside the migration sub folder
|
|
|
|
|
|
|
|
```sh
|
|
|
|
$ # install cargo-interactive-update if it is not already installed
|
|
|
|
$ cargo install cargo-interactive-update
|
2024-10-23 17:19:47 +00:00
|
|
|
$ # then launch it (from a sub-project directory)
|
2024-10-23 17:13:54 +00:00
|
|
|
$ cargo interactive-update
|
|
|
|
$ # select all the available updates in the TUI and apply them
|
|
|
|
$ # then go to the migration sub folder and do the same
|
|
|
|
$ cd migration
|
|
|
|
$ cargo interactive-update
|
|
|
|
```
|