This project implements a simple Book Management API using the Ulfius framework in C for the backend service and Python for testing the CRUD operations. The API allows creating, reading, updating, and deleting book records, which are stored in a file.
Before you begin, ensure you have met the following requirements:
- GCC compiler for C
- Ulfius Framework for the web server and REST functionality
- Jansson library for JSON handling in C
- Python 3.x and
requests
library for testing
-
Install Ulfius and Jansson Libraries: Follow the instructions from the official Ulfius documentation and Jansson documentation to install these libraries on your system.
-
Compile the C Application: Navigate to the project directory and compile the code using GCC. Make sure to link the Ulfius and Jansson libraries.
gcc -o main main.c -lulfius -ljansson
-
Install Python 3.x: Ensure Python 3.x is installed on your system.
-
Install Requests Library: Use pip to install the
requests
library.pip install requests
To start the Book Management API, run the compiled binary:
./main
The API will start listening for HTTP requests on port 8080.
To test the CRUD operations, execute the Python script tests.py
located in the tests
directory. Make sure the API is running before executing the tests.
python tests.py
This script tests creating a new book, reading all books, updating a book, and deleting a book.
Contributions to this project are welcome. To contribute:
- Fork the repository.
- Create a new branch (
git checkout -b feature/AmazingFeature
). - Make your changes and commit them (
git commit -m 'Add some AmazingFeature'
). - Push to the branch (
git push origin feature/AmazingFeature
). - Open a pull request.
This project is licensed under the LGPL-2.1 License - see the LICENSE file for details.