Skip to content

Simple TODO API created with Rocket.rs and SurrealDB

License

Notifications You must be signed in to change notification settings

mealet/todo_api.rs

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

🛠️ | 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 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)

  1. Run project by:
cargo run --release
  1. Open it in browser: 127.0.0.1

🦛 Routes

Request Type Route Adress Description
/ Index Page
/tasks All tasks
/tasks/<id> Get task by id
/tasks/new Create new task (JSON)
/tasks/<id>/edit Edit task by id (JSON)
/tasks/<id>/finish Finish task by id (JSON)
/tasks/<id>/definish Unfinish task by id (JSON)
/tasks/<id> Delete task by id

Important

To create/edit tasks send JSON data like this:

{
  "title": "TASK TITLE"
  "description": "TASK DESCRIPTION"
}

🦈 License

Project is licensed under the MIT License.
Check the LICENSE file for more.

About

Simple TODO API created with Rocket.rs and SurrealDB

Resources

License

Stars

Watchers

Forks

Languages