Skip to content

Latest commit

 

History

History
93 lines (70 loc) · 1.02 KB

README.md

File metadata and controls

93 lines (70 loc) · 1.02 KB

Actix Web API

This is a simple REST API built with Actix Web that supports CRUD operations with an in-memory data store.

Prerequisites

Running

Start the API server:

cargo run

By default, the server will be running at http://127.0.0.1:8080.

API Endpoints

Get All Items

GET /items

Response:

[
  {
    "id": "item-id-1",
    "name": "Item Name",
    "quantity": 10
  },
  {
    "id": "item-id-2",
    "name": "Another Item",
    "quantity": 5
  }
]

Get Single Item

GET /items/{id}

Response:

{
  "id": "item-id",
  "name": "Item Name",
  "quantity": 10
}

Add New Item

POST /items

Request Body:

{
  "name": "New Item",
  "quantity": 12
}

Response:

{
  "id": "newly-generated-id",
  "name": "New Item",
  "quantity": 12
}

Delete Item

DELETE /items/{id}

Response:

Status: 200 OK