Skip to content

ahmetsahinoglu/todo-server-rust

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

todo-server-rust

todo-server-rust is a Rust(actix-web) application provides Rest APIs that uses create, update and delete operations.

Installation

  1. Download and install Rust from here
  2. Download and install Cargo from here
git clone https://github.com/ahmetsahinoglu/todo-server-rust.git
cd todo-server-rust
Set your environment variable
$ export PORT=YOUR_PORT_NUMBER
How to start project in development mode
$ cargo run
How to build for production
$ cargo build --release
How to run unit tests.
$ cargo test

API List

  • Get TodoList http:127.0.0.1:{PORT}/v1/todo-list GET
  • Create Todo http:127.0.0.1:{PORT}/v1/todo-list POST
  • Update Todo http:127.0.0.1:{PORT}/v1/todo-list/{id} PATCH
  • Delete Todo http:127.0.0.1:{PORT}/v1/todo-list/{id} DELETE

###USAGE

Get TodoList

curl --location --request GET 'http:127.0.0.1:8080/v1/todo-list'

Create Todo

curl --location --request POST 'http:127.0.0.1:8080/v1/todo-list' \
--header 'Content-Type: application/json' \
--data-raw '{
    "text": "Pay rent.",
    "status": "ACTIVE"
}'

Update Todo

curl --location --request PUT 'localhost:8080/v1/todo-list/1' \
--header 'Content-Type: application/json' \
--data-raw '{
    "text": "Pay rent.",
    "status": "DONE"
}'

Delete Todo

curl --location --request DELETE 'localhost:8080/v1/todo-list/1'

Sample Response

[
  {
    "id": 1,
    "text": "Pay rent.",
    "status": "DONE"
  },
  {
    "id": 2,
    "text": "Prepare suitcase.",
    "status": "ACTIVE"
  }
]

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors