https://github.com/idematos/actix-web-api
A simple API that supports CRUD operations with in-memory storage.
https://github.com/idematos/actix-web-api
actix-web api rest-api rust rust-lang rustlang
Last synced: over 1 year ago
JSON representation
A simple API that supports CRUD operations with in-memory storage.
- Host: GitHub
- URL: https://github.com/idematos/actix-web-api
- Owner: idematos
- License: mit
- Created: 2024-09-25T14:58:26.000Z (almost 2 years ago)
- Default Branch: main
- Last Pushed: 2024-11-10T12:37:18.000Z (over 1 year ago)
- Last Synced: 2025-02-23T11:12:14.101Z (over 1 year ago)
- Topics: actix-web, api, rest-api, rust, rust-lang, rustlang
- Language: Rust
- Homepage:
- Size: 14.6 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Actix Web API
This is a simple REST API built with [Actix Web](https://actix.rs/) that supports CRUD operations with an in-memory data store.
## Prerequisites
- [Rust](https://www.rust-lang.org/)
- [Cargo](https://doc.rust-lang.org/cargo/)
## 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
```