About | Methods | Technologies | Requirements | Starting | Testing | Author
This project has two applications: a Rest API and a CLI application,
both written in C language.
The Rest API send, receive, change and remove movie data in format json, using
the methods POST, GET, PUT and DELETE, while print the logs in a file api.log
and also on terminal.
The CLI application is a simple applicaton which reads the api.log file and
prints a resume of this logs.
It's running on DigitalOcean cloud: http://162.243.163.141:8080/
-
POST:
localhost:8080/ - add a new movie
-
GET:
localhost:8080/ - lists all movies
localhost:8080/:id - lists a specifc movie
-
PUT:
localhost:8080/:id - modify an existing movie
-
DELETE:
localhost:8080/:id - delete an existing movie
A movie is a JSON object with the following model:
{
"id": "1",
"title": "Back to the Future",
"genre": "Sci-fi",
"year": "1985"
}
The following tools were used in this project:
Before starting, you need to have Git and Docker installed.
Rest API:
# Clone this project
git clone https://github.com/42sp/42labs-selection-process-v2-anolivei
# Access
cd 42labs-selection-process-v2-anolivei
# Run the project
bash run.sh
# The server will initialize in the <http://localhost:8080>
# To stop the server press enter
# To remove the container
docker rm labs_api
# To remove the images
docker rmi labs_api ubuntu
CLI Application:
# Open a new terminal and execute
docker exec -it labs_api /bin/bash
# Access
cd cli
# Compile and run
make run
Rest API:
# Open a new terminal and execute
docker exec -it labs_api /bin/bash
# Access
cd tests
# Run
bash test.sh