This is a sample for REST API in Rust 🦀
It provides creating, editing and fetching tasks from database.
- Install SurrealDB from official site and run it
- Download this code and edit
.env
file:
DB_URL=127.0.0.1:8000
DB_USERNAME=root
DB_PASSWORD=toor
DB_NS=somenamespace
DB_DATABASE=mydb
DB_URL - url adress to you'r database (on local machine it would be 127.0.0.1:8000)
DB_USERNAME - username for login (i've chosen 'root')
DB_PASSWORD - password for login
DB_NS - namespace (edit as you wish)
DB_DATABASE - database name (it will keep all you'r content)
- Run project by:
cargo run --release
- Open it in browser: 127.0.0.1
Important
To create/edit tasks send JSON data like this:
{
"title": "TASK TITLE"
"description": "TASK DESCRIPTION"
}
Project is licensed under the MIT License.
Check the LICENSE file for more.