Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/mealet/todo_api.rs
Simple TODO API created with Rocket.rs and SurrealDB
https://github.com/mealet/todo_api.rs
Last synced: about 2 months ago
JSON representation
Simple TODO API created with Rocket.rs and SurrealDB
- Host: GitHub
- URL: https://github.com/mealet/todo_api.rs
- Owner: mealet
- License: mit
- Created: 2024-11-04T14:52:33.000Z (2 months ago)
- Default Branch: master
- Last Pushed: 2024-11-08T14:51:08.000Z (2 months ago)
- Last Synced: 2024-11-08T15:39:15.769Z (2 months ago)
- Language: Rust
- Homepage:
- Size: 36.1 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# 🛠️ | Todo API
### 👀 What is this?
This is a sample for REST API in Rust 🦀
It provides creating, editing and fetching tasks from database.### ✈️ How to run this?
1. Install SurrealDB from [official site](https://surrealdb.com/) and run it
2. 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)3. Run project by:
```
cargo run --release
```
4. Open it in browser: [127.0.0.1](http://127.0.0.1:8080)### 🦛 Routes
| Request Type | Route Adress | Description |
| ------------ | ------------ | ----------- |
| | / | Index Page |
| | /tasks | All tasks |
| | /tasks/\ | Get task by id |
| | /tasks/new | Create new task (JSON) |
| | /tasks/\/edit | Edit task by id (JSON) |
| | /tasks/\/finish | Finish task by id (JSON) |
| | /tasks/\/definish | Unfinish task by id (JSON) |
| | /tasks/\ | Delete task by id |> [!IMPORTANT]
> To create/edit tasks send JSON data like this:
> ```json
> {
> "title": "TASK TITLE"
> "description": "TASK DESCRIPTION"
> }
> ```### 🦈 License
Project is licensed under the MIT License.
Check the [LICENSE](https://github.com/mealet/todo_api.rs/blob/master/LICENSE) file for more.