cargo watch -q -c -w src/ -x rundocker pull opqudk/stack-overflow-db:1.0| Name | Type | Description |
|---|---|---|
| question_uuid | UUID | Generated identifier unique to each question |
| title | VARCHAR(255) | Title of the question |
| description | VARCHAR(255) | Description of the question |
| created_at | TIMESTAMP | Creation timestamp of the question |
| Name | Type | Description |
|---|---|---|
| answer_uuid | UUID | Generated identifier unique to each answer |
| question_uuid | UUID | Generated identifier unique to each question |
| content | VARCHAR(255) | Content of the answer |
| created_at | TIMESTAMP | Creation timestamp of the answer |
POST /question
Sample request
curl --request POST \
--url http://localhost:8000/question \
--header 'Accept: application/json' \
--data '{
"title": "Newly Created Question",
"description": "My Description"
}'Sample response
{
"question_uuid": "d347261c-3f0e-42d2-8706-5ef9f1b96725",
"title": "Newly Created Question",
"description": "My Description",
"created_at": "2024-01-01 00:00:00.000000"
}GET /questions
Sample request
curl --request GET \
--url http://localhost:8000/questions \
--header 'Accept: application/json'Sample response
[
{
"question_uuid": "d347261c-3f0e-42d2-8706-5ef9f1b96725",
"title": "Newly Created Question",
"description": "My Description",
"created_at": "2024-01-01 00:00:00.000000"
}
]Question deletion
DELETE /question
Sample request
curl --request DELETE \
--url http://localhost:8000/question \
--header 'Accept: application/json' \
--data '{
"question_uuid": "b068cd2f-edac-479e-98f1-c5f91008dcbd"
}'Sample response
HTTP 200 OK
POST /answer
Sample request
curl --request POST \
--url http://localhost:8000/answer \
--header 'Accept: application/json' \
--data '{
"question_uuid": "b068cd2f-edac-479e-98f1-c5f91008dcbd",
"content": "test question"
}'Sample response
{
"answer_uuid": "a1a14a9c-ab9e-481b-8120-67f675531ed2",
"question_uuid": "b068cd2f-edac-479e-98f1-c5f91008dcbd",
"content": "test question",
"created_at": "2024-01-01 00:00:00.000000"
}GET /answers
Sample request
curl --request GET \
--url http://localhost:8000/answers \
--header 'Accept: application/json' \
--data '{
"question_uuid": "b068cd2f-edac-479e-98f1-c5f91008dcbd"
}'Sample response
[
{
"answer_uuid": "a1a14a9c-ab9e-481b-8120-67f675531ed2",
"question_uuid": "b068cd2f-edac-479e-98f1-c5f91008dcbd",
"content": "test question",
"created_at": "2024-01-01 00:00:00.000000"
}
]DELETE /answer
Sample request
curl --request DELETE \
--url http://localhost:8000/answer \
--header 'Accept: application/json' \
--data '{
"answer_uuid": "a1a14a9c-ab9e-481b-8120-67f675531ed2"
}'Sample response
HTTP 200 OK
- Designing & building APIs
- Using a backend framework (
Rocket) - Using a database (
PostgreSQL) - Using third-party crates (
tokio) - Writing testable code (
TDD) - Organizing code using modules
- Navigating and contributing to an existing code base