A Simple task system.
The python version is 3.10
This project use poetry to manage packages and environment, please install it if you don't have poetry on your computer. Or, just run docker-compose to start the service.
pip install -U poetry
then run this command to do initialization.
poetry install
To activate virtualenv, exec the following command:
poetry shell
Execute the following command to run the server, if you're out of virtualenv, add poetry run
before this command.
flask --app app.main run
Or, run docker directly.
docker compose up
field | type | note |
---|---|---|
id | int | |
name | string | |
status | bool | 0 or 1 |
GET /tasks
Response {
"result": [
{"id": 1, "name": "name", "status": 0}
]
}
POST /task
Request {
"name": "買晚餐"
}
Response (201) {
"result": {"name": "買晚餐", "status": 0, "id": 1}
}
PUT /task/
Request {
"name": "買早餐", "status": 1 "id": 1
}
Response (200) {
"result": {"name": "買早餐", "status": 1, "id": 1}
}
DELETE /task/
Response (200)
Run pytest
directly, adding peotry run
if you're out of the poerty shell.
# run with docker
docker exec -i tasksys poetry run pytest