This project was done during the 42Labs (internship) selection process of 42 São Paulo. The main goal was to create a REST API using C, collect logs of the application and also a CLI to visualize the logs.
The main idea of this API is to be used to control inventory of the 42Store.
-
List endpoints
: The user can list all available endpoints.GET /
-
List items
: The user can list all created items.GET /items
-
Create item
: The user can create an item.POST /items
{ "name": "item_name" }
name: A string containing the item name.
-
List transactions
: The user can list all created transactions.GET /transactions
-
Create transactions
: The use can create a transaction.POST /transactions
{ "item_id": 42, "item_quantity": 42, "type": "in" }
item_id: An int of an already created item id.
item_quantity: An int for the item quantity.
type: A string containing in or out depending on the type of the transaction.
First of all, you need to install Docker.
docker run --name 42labsdb -p 3306:3306 -d acarneirosousa/42labsdb:v0
git clone https://github.com/a-cs/42StoreAPI.git 42store
cd 42store
sudo apt-get update
sudo apt-get install libmysqlclient-dev
make
export PATH=$PATH:$(pwd)
42store_api
42store_cli