Updating readme

This commit is contained in:
Steve White 2024-10-15 17:37:16 -05:00
parent b29cb8133a
commit 3cb082b3b0
1 changed files with 14 additions and 1 deletions

View File

@ -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. 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 ## Features
- Manage boxes and items stored within them. - Manage boxes and items stored within them.
- JWT-based authentication. - JWT-based authentication.
- Automatic database creation if it doesn't exist. - 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. - Containerized using Docker.
## Tech Stack ## Tech Stack
- **Language:** Go - **Language:** Go
- **Database:** SQLite3 - **Database:** SQLite3
- **Authentication:** JWT - **Authentication:** JWT
@ -21,10 +23,12 @@ This project is a backend API built using Go, designed for managing boxes and th
## API Endpoints ## API Endpoints
### Authentication ### Authentication
- **POST** `/login` - **POST** `/login`
Authenticates a user and returns a JWT. Authenticates a user and returns a JWT.
### Boxes ### Boxes
- **GET** `/boxes` - **GET** `/boxes`
Retrieves all boxes. Retrieves all boxes.
- **POST** `/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. Retrieves all items in a box by its ID.
### Items ### Items
- **GET** `/items` - **GET** `/items`
Retrieves all items, optionally searchable by description. Retrieves all items, optionally searchable by description.
- **POST** `/items` - **POST** `/items`
@ -64,6 +69,7 @@ image_storage_directory: "./images"
## Setup and Running ## Setup and Running
### Prerequisites ### Prerequisites
- Docker - Docker
- Go (if running locally) - Go (if running locally)
- SQLite3 - SQLite3
@ -71,11 +77,13 @@ image_storage_directory: "./images"
### Running with Docker ### Running with Docker
1. Build the Docker image: 1. Build the Docker image:
```bash ```bash
docker build -t box-management-api . docker build -t box-management-api .
``` ```
2. Run the Docker container: 2. Run the Docker container:
```bash ```bash
docker run -p 8080:8080 box-management-api docker run -p 8080:8080 box-management-api
``` ```
@ -83,17 +91,20 @@ image_storage_directory: "./images"
### Running Locally ### Running Locally
1. Clone the repository: 1. Clone the repository:
```bash ```bash
git clone https://github.com/your-repo/box-management-api.git git clone https://github.com/your-repo/box-management-api.git
cd box-management-api cd box-management-api
``` ```
2. Build the Go application: 2. Build the Go application:
```bash ```bash
go build -o main . go build -o main .
``` ```
3. Run the application: 3. Run the application:
```bash ```bash
./main ./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). - `items`: Contains `id` (int), `name` (text), `description` (text), `box_id` (int), and `image_path` (text).
- `users`: Contains `id` (int), `username` (text), and `password` (hashed). - `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: 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 ## Logs
The following events are logged to the file specified in the configuration: The following events are logged to the file specified in the configuration:
- User logins - User logins
- Box creation/deletion - Box creation/deletion
- Item creation/deletion - Item creation/deletion
## License ## License
This project is licensed under the MIT License. This project is licensed under the MIT License.