CHI Rest API π»
This is a simple RESTful API project developed using Golang π, Swagger π, Chi π·, and SQLite π. The purpose of this API is to create and manage users π₯ and products π¦. It provides endpoints for creating, retrieving, updating, and deleting users and products.
π Project Structure
chi-rest-api/
ββ cmd/
β ββ server/
β β ββ main.go
ββ configs/
β ββ configs.go
ββ docs/
ββ internal/
β ββ dto/
β ββ entity/
β ββ infra/
β β ββ database/
β β ββ webserver/
ββ pkg/
β ββ entity/
ββ test/
-
cmd/server/: Contains the main application file for your server.
-
configs/: Houses configuration files or settings for your Go application.
-
docs/: May include documentation files or assets related to your project.
-
internal/: Organizes your internal code, with separate folders for DTO, entities, and infrastructure.
-
internal/infra/: Infrastructure code with subdirectories for database and webserver.
-
pkg/entity/: Contains code related to entities used in your application.
-
test/: May include test files or assets for your project.
π οΈ Prerequisites
Before running this project, you'll need to have Golang and SQLite installed on your system.
π Running the Project
To run the project:
-
Clone this repository to your local machine.
-
Open your terminal and navigate to the project's root directory:
cd chi-rest-api
-
Run the following command to start the application:
go run ./cmd/server/main.go
-
The API will be available at http://localhost:3001
.
Usage π»
You can use tools like curl or Postman to interact with the API. The API provides endpoints for creating, retrieving, updating, and deleting users and products.
Swagger Documentation π
The API is documented using Swagger, providing comprehensive details about endpoints, request parameters, and response formats. Access the Swagger documentation at http://localhost:3001/swagger/index.html
when the API is running.
Database π
This project uses SQLite as the database for simplicity. You can find the database file in the data
directory.
π€ Contributing
If you wish to contribute to this project, please follow these guidelines:
-
Fork the repository.
-
Create a new branch for your feature or bug fix.
-
Implement your changes.
-
Test your changes thoroughly.
-
Create a pull request with a clear description of your changes.
π License
This project is licensed under the MIT License. Feel free to use and modify it according to your needs.
Enjoy using this CHI Rest API with Golang, Swagger, Go-Chi, and SQLite for managing users and products! π
You can further customize this README with your specific details and make any additional changes as needed.