• Stars
    star
    142
  • Rank 258,408 (Top 6 %)
  • Language
    Rust
  • Created almost 5 years ago
  • Updated over 4 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Todo list API made in rust + actix-web + tokio-postgres

actix-todo Build Status

Simple TODO list API made in rust

Requirements

  • Rust
  • Docker
  • docker-compose

Usage

# Copy example .env file
cp .env.example .env

# Run postgres
docker-compose up -d postgres

# Install diesel
cargo install diesel_cli --no-default-features --features postgres

# Run db migrations
DATABASE_URL=postgres://actix:actix@localhost:5432/actix diesel migration run

# Run unit tests
cargo test

# Run integration tests
cargo test --features "integration"

# Run the server (Add --release for an optimized build)
cargo run 
curl -s http://localhost:8080/

Routes

  • GET / -> Status

    Response:

    {
      "status": "Up"
    }
    
  • GET /todos -> Get todo lists

    Response:

    [
      {
        "id": 1,
        "title": "Grocery list"
      },
      ...
    [
    
  • GET /todos/1 -> Get single todo list

    Response:

    {
      "id": 1,
      "title": "Grocery list"
    }
    
  • POST /todos -> Create todo list

    Request Header:

    Content-Type: application/json
    

    Request Body:

    {
      "title": "List title"    
    }
    

    Response:

    {
      "id": 1,
      "title": "Grocery list"
    }
    
  • GET /todos/1/items -> Get items of the todo list

    Response:

    [
      {
        "id": 1,
        "list_id": 1,
        "title": "Milk",
        "checked": true
      },
      {
        "id": 1,
        "list_id": 2,
        "title": "Bread",
        "checked": false
      }
    ]
    
  • GET /todos/1/items/1 -> Get single item of the todo list

    Response:

    {
      "id": 1,
      "list_id": 1,
      "title": "Milk",
      "checked": true
    }
    
  • POST /todos/1/items -> Create todo list item

    Request Header:

    Content-Type: application/json
    

    Request Body:

    {
      "title": "Eggs"    
    }
    

    Response:

    {
      "id": 1,
      "list_id": 1,
      "title": "Eggs",
      "checked": false
    }
    
  • PUT /todos/1/items/1 -> Check todo

    Response:

    {
      "result": true
    }
    

    Result:

    • true -> Checked
    • false -> Already checked. Nothing to do.

More Repositories

1

actix-blog-app

Blog app backend made in actix and graphql (WIP)
Rust
62
star
2

user-auth

User Authentication microservice made in Rust (WIP)
Rust
57
star
3

hello-rocket

Source code for the video "Rust web development | Boilerplate free with Rocket"
Rust
20
star
4

openfonacide

Open Data platform for the fonacide project in Paraguay
JavaScript
6
star
5

darti-frontend

Darti project sensor information dashboard
JavaScript
6
star
6

fibonacci

Fibonacci microservice demo made in Actix 3 to demostrate the use of OpenTelemetry for Ditributed Tracing
Rust
4
star
7

voting-app

FreeCodeCamp Basejump: Build a Voting App
JavaScript
4
star
8

darti-backend

Darti project sensor information backend
Python
3
star
9

trazareweb

Simple vocational test made in Laravel, AngularJS and Bootstrap
PHP
1
star
10

aep-collector

Data collector
Rust
1
star
11

dlnd-tv-script-generation

Udacity Deep Learning Foundations - Project 3
HTML
1
star
12

privacy_policy

Ignore this.
1
star
13

defi-automation

1
star
14

nemesiscodex

1
star
15

transactions

Calculate real-time transaction statistics from the last 60 seconds
Java
1
star
16

school

Django school management (testing django 2.0)
Python
1
star
17

JukyOS-builder

JukyOS sugar distribution based on Dextrose
Shell
1
star
18

aep-dashboard

CSS
1
star
19

javaNews

HTML
1
star
20

aep-deployment

1
star
21

leetcode-solutions

My leetcode solutions
Rust
1
star
22

environment-napethread-staging

Makefile
1
star
23

codein-chrome-leaderboard

Unofficial google code-in leaderboard chrome extension
JavaScript
1
star
24

fcc-basejumps

FreeCodeCamp Basejumps template. Yeoman angular-fullstack with semantic-ui
JavaScript
1
star
25

dev-blog

JavaScript
1
star
26

JukyOS-sugar

JukyOS sugar modifications
Python
1
star