82 lines
1.8 KiB
Markdown
82 lines
1.8 KiB
Markdown
|
# Boxes API
|
||
|
|
||
|
## Overview
|
||
|
|
||
|
This is a back-end application written in Go that provides an API for managing boxes and items stored within those boxes. It uses SQLite3 as its database and supports JWT-based authentication.
|
||
|
|
||
|
## Features
|
||
|
|
||
|
- **Box Management:** Create, retrieve, and delete boxes.
|
||
|
- **Item Management:** Add, retrieve, update, and delete items within boxes.
|
||
|
- **Image Storage:** Store images associated with items.
|
||
|
- **JWT Authentication:** Secure API access with JSON Web Tokens.
|
||
|
- **Configuration:** Manage settings via a `config.yaml` file.
|
||
|
- **Logging:** Logs user logins and box/item actions to a file.
|
||
|
|
||
|
## API Documentation
|
||
|
|
||
|
See the [API Specification](api_specification.md) for detailed information on endpoints, request/response formats, and authentication.
|
||
|
|
||
|
## Getting Started
|
||
|
|
||
|
1. **Clone the repository:**
|
||
|
|
||
|
```bash
|
||
|
|
||
|
git clone https://github.com/your-username/boxes-api.git
|
||
|
|
||
|
```
|
||
|
|
||
|
2. Configuration:
|
||
|
|
||
|
- Create a config.yaml file in the project root directory.
|
||
|
- Refer to the config.yaml.example file for available settings.
|
||
|
|
||
|
3. Database Setup:
|
||
|
|
||
|
- The database will be automatically created if it doesn't exist.
|
||
|
- Configure the database path in the config.yaml file.
|
||
|
|
||
|
4. Running the Application:
|
||
|
|
||
|
- Build and run the Go application:
|
||
|
|
||
|
```bash
|
||
|
|
||
|
go run boxes-api .
|
||
|
|
||
|
```
|
||
|
|
||
|
5. Run the test script:
|
||
|
|
||
|
``` bash
|
||
|
|
||
|
./tests.bash
|
||
|
|
||
|
```
|
||
|
|
||
|
## Podman Support
|
||
|
|
||
|
Build the podman image:
|
||
|
|
||
|
```bash
|
||
|
|
||
|
podman build -t boxes-api .
|
||
|
|
||
|
```
|
||
|
|
||
|
Run the podman container:
|
||
|
|
||
|
```bash
|
||
|
|
||
|
podman run \
|
||
|
-e CONFIG="/app/config/config.yaml" \
|
||
|
-v /Users/stwhite/CODE/boxes/data:/app/data \
|
||
|
-v /Users/stwhite/CODE/boxes/images:/app/images \
|
||
|
-v /Users/stwhite/CODE/boxes/config:/app/config \
|
||
|
-p 8080:8080 \
|
||
|
--name boxes-api-container \
|
||
|
localhost/boxes-api
|
||
|
|
||
|
```
|