Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/marcelobarreto/products-service-go
https://github.com/marcelobarreto/products-service-go
Last synced: 5 days ago
JSON representation
- Host: GitHub
- URL: https://github.com/marcelobarreto/products-service-go
- Owner: marcelobarreto
- Created: 2020-09-12T21:50:46.000Z (over 4 years ago)
- Default Branch: master
- Last Pushed: 2020-09-12T21:51:08.000Z (over 4 years ago)
- Last Synced: 2024-11-15T08:25:15.426Z (about 2 months ago)
- Language: Go
- Size: 4.35 MB
- Stars: 1
- Watchers: 1
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Products Service with Go lang
Small CRUD application with Go, using Fiber + GORM.
## GET /products
List all products
### Response:
```json
[
{
"id": 1,
"code": "USD187",
"name": "",
"price": 43.9,
"discount": 10,
"store_id": 1,
"store": {
"id": 1,
"name": "Foo Store",
"Open": true
}
},
{
"id": 2,
"code": "USD187",
"name": "",
"price": 43.9,
"discount": 10,
"store_id": 1,
"store": {
"id": 1,
"name": "Foo Store",
"Open": true
}
},
{
"id": 3,
"code": "USD187",
"name": "",
"price": 43.9,
"discount": 10,
"store_id": 1,
"store": {
"id": 1,
"name": "Foo Store",
"Open": true
}
},
{
"id": 5,
"code": "BRL1187",
"name": "",
"price": 43.9,
"discount": 10,
"store_id": 1,
"store": {
"id": 1,
"name": "Foo Store",
"Open": true
}
},
{
"id": 6,
"code": "FOO187",
"name": "",
"price": 43.9,
"discount": 10,
"store_id": 1,
"store": {
"id": 1,
"name": "Foo Store",
"Open": true
}
},
{
"id": 7,
"code": "FOO187",
"name": "",
"price": 43.9,
"discount": 10,
"store_id": 1,
"store": {
"id": 1,
"name": "Foo Store",
"Open": true
}
},
{
"id": 8,
"code": "FOO187",
"name": "",
"price": 43.9,
"discount": 10,
"store_id": 1,
"store": {
"id": 1,
"name": "Foo Store",
"Open": true
}
},
{
"id": 2002,
"code": "BRL1187",
"name": "",
"price": 43.9,
"discount": 10,
"store_id": 1,
"store": {
"id": 1,
"name": "Foo Store",
"Open": true
}
}
]
```## GET /products/:id
List specific product
### Response
```json
{
"id": 1,
"code": "USD187",
"name": "",
"price": 43.9,
"discount": 10,
"store_id": 1,
"store": {
"id": 1,
"name": "Foo Store",
"Open": true
}
}
```## POST /products
Creates a new product
### Body
```json
{
"price": 43.90,
"code": "FOO187",
"discount": 10.0,
"store_id": 1
}
```### Response
```json
{
"id": 8,
"code": "FOO187",
"name": "",
"price": 43.9,
"discount": 10,
"store_id": 1,
"store": {
"id": 1,
"name": "Foo Store",
"Open": true
}
}
```## PUT /products/:id
Updates a product
### Body
```json
{
"price": 43.90,
"code": "BRL1187",
"discount": 10.0
}
```### Response
```json
{
"id": 5,
"code": "BRL1187",
"name": "",
"price": 43.9,
"discount": 10,
"store_id": 1,
"store": {
"id": 1,
"name": "Foo Store",
"Open": true
}
}
```## DELETE /products/:id
Delete a product
### Response
Status: OK