Spaces:
Configuration error
Configuration error
Update README.md
Browse files123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707112345678# Golang API Boilerplate
This is a boilerplate for a RESTful API written in Golang.
## Features
- [x] JWT Authentication
- [x] PostgreSQL Database
- [x] GORM ORM
- [x] Gin Framework
- [x] Docker Support
- [x] Environment Variables
- [x] Logging
- [x] Error Handling
## Getting Started
1. Clone the repository
2. Run `go get` to download the dependencies
3. Create a file named `.env` and add the following variables:
* `DB_HOST`
* `DB_USER`
* `DB_PASSWORD`
* `DB_NAME`
* `DB_PORT`
* `SALT`
* `HOST_ADDRESS`
* `HOST_PORT`
* `LOG_PATH`
4. Run `go run main.go` to start the server
5. Open your browser and navigate to `http://localhost:HOST_PORT`
## API Endpoints
### Authentication
- `POST /login`: Login with email and password
- `POST /register`: Register a new user
- `GET /logout`: Logout
### Users
- `GET /users`: Get all users
- `GET /users/:id`: Get a user by ID
- `PUT /users/:id`: Update a user
- `DELETE /users/:id`: Delete a user
## Docker Support
You can build a Docker image by running `docker build -t my-api .` and then run it with `docker run -p 8080:8080 my-api`.
## Environment Variables
You can set the following environment variables:
- `DB_HOST`
- `DB_USER`
- `DB_PASSWORD`
- `DB_NAME`
- `DB_PORT`
- `SALT`
- `HOST_ADDRESS`
- `HOST_PORT`
- `LOG_PATH`
## Logging
The API uses the `log` package to log errors. You can set the `LOG_PATH` environment variable to specify the log file path.
## Error Handling
The API uses the `errors` package to handle errors. You can set the `ERROR_PATH` environment variable to specify the error file path.
# Command Documentation
## Update Golang Project version
> go mod edit -go 1.24
> go mod tidy
## Update all package
> go get -u ./...
> go mod tidy---title: Quzuu Api Devemoji: 🐠colorFrom: indigocolorTo: graysdk: dockerpinned: false---README.md+8-71