A web server built with Rocket and Diesel using PostgreSQL. It provides CRUD operations on TODOs.
Note that Rocket v0.5 is used. There some differences between Rocket v0.4 and Rocket v0.5 such as crate rocket_contrib
is integrated into crate rocket
. This repo fully uses Rocket v0.5 features.
docker-compose run
Field | Type |
---|---|
id | Integer |
creator_name | String(100) |
title | String(256) |
description | String(1000) |
created_at | Timestamp with Timezone |
GET /todos
For example, if you use curl command:
curl -X GET http://0.0.0.0:8000/todos
GET /todos?order={asc,desc}
For example, if you use curl command:
curl -X GET http://0.0.0.0:8000/todos?order=asc
GET /todos/{id}
For example, if you use curl command:
curl -X GET http://0.0.0.0:8000/todos/1
POST /todos/
You need to send JSON data like below.
Key | Value |
---|---|
creator_name | String(100) |
title | String(256) |
description | String(1000) |
For example, if you use curl command:
curl -X POST \
-H "Content-Type: application/json" \
-d '{"creator_name":"JihoonSong", "title": "Meeting at 3PM", "description": "Weekly scrum"}' \
http://0.0.0.0:8000/todos
PUT /todos/{id}
You need to send JSON data like below.
Key | Value |
---|---|
creator_name | String(100) |
title | String(256) |
description | String(1000) |
For example, if you use curl command:
curl -X PUT \
-H "Content-Type: application/json" \
-d '{"creator_name":"JihoonSong", "title": "Lunch at 1PM", "description": "With J"}' \
http://0.0.0.0:8000/todos/1
DELETE /todos/{id}
For example, if you use curl command:
curl -X DELETE http://0.0.0.0:8000/todos/1
This project is licensed under the MIT License. See LICENSE for details.