- Go 1.25.5
- The application handles the following 5 operations for items in the database:
- Getting all the inventory via
/inventorypath, - Getting a single item via
/inventory/{id}path, - Creating an item via
/inventorypath, - Updating an item via
/inventory/{id}path, - Deleting an item via
/inventory/{id}path.
- Getting all the inventory via
- Each inventory item includes:
- ID,
- Name,
- Stock,
- Price.
- Items are stored appropriately in a basic local PostgreSQL database.
- The server returns JSON responses.
- Pagination, filtering, and sorting are enabled.
- Requests are rate limited.
- Maps, structs, interfaces, generics.
- Database operations with GORM.
- Serving and routing with Gin.
- API documentation powered by Stoplight Elements.
- Make sure you have Go and PostgreSQL installed.
- Clone, or download and extract the repository.
- Change to the root of the project.
- Run the following command to create the
.envfile:cp .env.example .env
- You may want to adjust the value of the
SERVICE_DB_PASSWORDin the.envfile, if you created one during the installation/configuration of the PostgreSQL. - Run the following command to finish the setup and start the server:
go run main.go
- Head over to the http://localhost:3000 in your browser and examine the API documentation.
- You can send API requests directly from the documentation UI.
The project requirements were provided as a part of the Backend Developer with Go Nanodegree Program at Udacity.