This project is a RESTful API for a simple CRUD (Create, Read, Update, Delete) system, built with Go.
- Go: Programming language used to develop the application.
- Chi: Lightweight and fast HTTP router for Go.
- GORM: ORM (Object-Relational Mapping) in Go for database handling.
- SQLite: Embedded SQL database system.
- Swaggo: API documentation tool for Go.
To install and run this project locally, follow these steps:
- Clone the repository to your local machine.
- Navigate to the project directory.
- Run
go mod tidy
to download the project dependencies. - Run
go run cmd/server/main.go
to start the server.
The API supports the following operations:
POST /users
: Creates a new user.POST /users/generate_token
: Generates a JWT token for a user.GET /users
: Returns all users.POST /products
: Creates a new product.GET /products
: Returns all products.GET /products/{id}
: Returns a specific product.PUT /products/{id}
: Updates a specific product.DELETE /products/{id}
: Deletes a specific product.
The API documentation is available at http://localhost:8000/docs/doc.json
when the server is running.
Contributions are welcome! Please feel free to open an issue or submit a pull request.