Welcome to the Book Dragon API! This is a RESTful backend service built with Go and the Chi router, featuring user authentication and SQLite for data storage.
- Go (1.20 or later recommended)
To ensure tests run automatically on commit, run the following command once to configure Git hooks:
git config core.hooksPath .githooks-
Ensure you have downloaded the required dependencies:
go mod download
-
Start the API server:
go run cmd/api/main.go
The server will start on http://localhost:8080 by default. It will also automatically create a bookdragon.db SQLite database file in your current directory if it doesn't already exist.
Alternatively, you can use Docker to build and run the API. For complete setup steps and usage instructions, please refer to the Docker Build & Deployment Guide.
Once the server is running, you can test the Register endpoint. Open a new terminal window and use curl to create a new user account:
curl -X POST http://localhost:8080/register \
-H "Content-Type: application/json" \
-d '{
"username": "dragonrider",
"email": "rider@example.com",
"password": "supersecretpassword"
}'If successful, you should receive a 201 Created response containing your new user details AND an authentication token you can use to log in to other endpoints!
This project includes interactive OpenAPI (Swagger) documentation. Once your server is running, you can explore all available endpoints, their required schemas, and even test them directly from your browser by visiting: