Skip to content

A Simple API demonstration in Rust, Actix Web and Mongodb

Notifications You must be signed in to change notification settings

FeezyHendrix/rust-actix-mongodb

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Rust MongoDB TodoList API

A Simple Todolist API in Rust and Actix Web! This API allows you to manage a todo list, including creating, reading, updating, and deleting tasks. It is built using Rust, Actix-web, and MongoDB.

Features

  • Create a new todo item
  • Retrieve all todo items
  • Retrieve a single todo item by ID
  • Update a todo item by ID
  • Delete a todo item by ID

Requirements

  • Rust (latest stable version)
  • MongoDB (running instance)
  • Cargo (Rust package manager)

Getting Started

Clone the repository

git clone https://github.com/FeezyHendrix/rust-actix-mongodb.git
cd rust-actix-mongodb

Setup MongoDB

Ensure you have MongoDB installed and running. You can find installation instructions here.

Build and Run

  1. Install Rust dependencies:

    cargo build
  2. Run the API:

    cargo run

The API will be available at https://localhost:8080.

API Endpoints

Create a new todo item

  • URL: /todos
  • Method: POST
  • Request Body:
    {
      "content": "Your todo content",
      "is_done": false
    }
  • Response:
    {
      "message": "Successful"
    }

Retrieve all todo items

  • URL: /todos
  • Method: GET
  • Response:
    [
      {
        "content": "Your todo content",
        "is_done": false
      },
      ...
    ]

Retrieve a single todo item by ID

  • URL: /todos/{id}
  • Method: GET
  • Response:
    {
      "content": "Your todo content",
      "is_done": false
    }

Update a todo item by ID

  • URL: /todos/{id}
  • Method: PUT
  • Request Body:
    {
      "content": "Updated content",
      "is_done": true
    }
  • Response:
    {
      "message": "Updated Successfully"
    }

Delete a todo item by ID

  • URL: /todos/{id}
  • Method: DELETE
  • Response:
    {
      "message": "Todo item deleted successfully"
    }

About

A Simple API demonstration in Rust, Actix Web and Mongodb

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages