diff --git a/README.md b/README.md index 522abbf..59909eb 100644 --- a/README.md +++ b/README.md @@ -4,6 +4,7 @@ This project is a backend API built using Go, designed for managing boxes and the items stored in those boxes. The application is containerized using Docker and uses SQLite3 for data storage. It also supports JWT-based authentication and logs various activities such as logins and box/item operations. ## Features + - Manage boxes and items stored within them. - JWT-based authentication. - Automatic database creation if it doesn't exist. @@ -13,6 +14,7 @@ This project is a backend API built using Go, designed for managing boxes and th - Containerized using Docker. ## Tech Stack + - **Language:** Go - **Database:** SQLite3 - **Authentication:** JWT @@ -21,10 +23,12 @@ This project is a backend API built using Go, designed for managing boxes and th ## API Endpoints ### Authentication + - **POST** `/login` Authenticates a user and returns a JWT. ### Boxes + - **GET** `/boxes` Retrieves all boxes. - **POST** `/boxes` @@ -35,6 +39,7 @@ This project is a backend API built using Go, designed for managing boxes and th Retrieves all items in a box by its ID. ### Items + - **GET** `/items` Retrieves all items, optionally searchable by description. - **POST** `/items` @@ -64,6 +69,7 @@ image_storage_directory: "./images" ## Setup and Running ### Prerequisites + - Docker - Go (if running locally) - SQLite3 @@ -71,11 +77,13 @@ image_storage_directory: "./images" ### Running with Docker 1. Build the Docker image: + ```bash docker build -t box-management-api . ``` 2. Run the Docker container: + ```bash docker run -p 8080:8080 box-management-api ``` @@ -83,17 +91,20 @@ image_storage_directory: "./images" ### Running Locally 1. Clone the repository: + ```bash git clone https://github.com/your-repo/box-management-api.git cd box-management-api ``` 2. Build the Go application: + ```bash go build -o main . ``` 3. Run the application: + ```bash ./main ``` @@ -106,7 +117,7 @@ The application creates the following SQLite3 tables: - `items`: Contains `id` (int), `name` (text), `description` (text), `box_id` (int), and `image_path` (text). - `users`: Contains `id` (int), `username` (text), and `password` (hashed). -## Authentication +## Authentication API The API uses JWT-based authentication. A default user is created on startup: @@ -116,9 +127,11 @@ The API uses JWT-based authentication. A default user is created on startup: ## Logs The following events are logged to the file specified in the configuration: + - User logins - Box creation/deletion - Item creation/deletion ## License + This project is licensed under the MIT License.