https://github.com/heig-vd-dai-course
Web · PDF
L. Delafontaine and H. Louis, with the help of GitHub Copilot.
This work is licensed under the CC BY-SA 4.0 license.
The API for the demonstration is accessible at https://heig-vd-dai-course.dedyn.io.
Locally - Compile the project:
./mvnw clean package
Locally - Build the Docker image with Docker Compose:
docker compose build
Locally - Publish the Docker image to the container registry:
docker compose push
On the server - Pull the Docker image from the container registry:
docker compose pull
On the server - Start Traefik (the reverse proxy):
docker compose -f traefik/docker-compose.yml up -d
On the server - Start the CRUD API:
docker compose -f api/docker-compose.yml up -d
Create a few drinks:
# Hot wine curl -X POST \ -H "Content-Type: application/json" \ -d '{"name":"Hot wine","description":"Hot wine with spices","price":3.0}' \ https://heig-vd-dai-course.dedyn.io/drinks # Christmas tea curl -X POST \ -H "Content-Type: application/json" \ -d '{"name":"Christmas tea","description":"Warm tea","price":2.0}' \ https://heig-vd-dai-course.dedyn.io/drinks
Get the list of drinks:
curl https://heig-vd-dai-course.dedyn.io/drinks
Output:
[ { "id": 1, "name": "Hot wine", "description": "Hot wine with spices", "price": 3.0 } // All the other drinks ]
Filter the drinks with a price equal to 2.0 CHF:
curl https://heig-vd-dai-course.dedyn.io/drinks?price=2.0
[ { "id": 2, "name": "Christmas tea", "description": "Warm tea", "price": 2.0 } ]
Get a specific drink:
curl https://heig-vd-dai-course.dedyn.io/drinks/1
{ "id": 1, "name": "Hot wine", "description": "Hot wine with spices", "price": 3.0 }
Update a drink:
curl -X PUT \ -H "Content-Type: application/json" \ -d '{"name":"Hot wine","description":"Nice hot wine","price":3.0}' \ https://heig-vd-dai-course.dedyn.io/drinks/1
{ "id": 1, "name": "Hot wine", "description": "Nice hot wine", "price": 3.0 }
Delete a drink:
curl -X DELETE -i https://heig-vd-dai-course.dedyn.io/drinks/1
HTTP/2 204 content-type: text/plain date: Sat, 16 Dec 2023 13:31:56 GMT
No content as we return a 204 (No Content) status code!
204
Adding another drink with the same name:
curl -X POST \ -H "Content-Type: application/json" \ -d '{"name":"Christmas tea","description":"Another tea","price":2.0}' \ https://heig-vd-dai-course.dedyn.io/drinks
Conflict
Leads to a 409 (Conflict) status code as we want to keep the names unique.
409
This is important, please read carefully!
The practical work review will take place on Tuesday 23.01.2024 in the room B51a, next to our classroom.
We only have 10 minutes per group (10 minutes of presentation, no time for questions). Please be prepared to present your work. You decide what you want to show us and how you want to present it.
Come 5 minutes before your time slot with your computer.
The order of presentation is random and is stated in the next slides.
You can find the practical work for this part on GitHub.
Grades will be entered into GAPS, followed by an email with the feedback.
The evaluation will use exactly the same grading grid as shown in the course material.
Each criterion will be accompanied by a comment explaining the points obtained, a general comment on your work and the final grade.
If you have any questions about the evaluation, you can contact us!
Can you let us know what was easy and what was difficult for you during this practical work?
This will help us to improve the course and adapt the content to your needs. If we notice some difficulties, we will come back to you to help you.
GitHub Discussions
You can use reactions to express your opinion on a comment!
**Please state your group on GitHub Discussions as soon as possible, even if you do not have a clear idea yet as it will help us to plan the practical work review.**