This is a recreation of Galvanize's gsnack backend from node, express to Go.
- Fork/ clone this repository
- open psql, createdb snacks_dev
- go build
- go run main.go
- Use postman to test routes
GET /api/snacks
GET /api/snacks/featured
GET /api/snacks/:id
POST /api/snacks
- required fields in body:
{
name, // STRING
description, // STRING
price, // INT
img, // STRING
is_perishable // BOOLEAN
}
POST /api/snacks/:id/reviews
- required fields in body:
{
title, // STRING
text, // STRING
rating, // INTEGER
}
PATCH /api/snacks/:id
- at least one(1) of the following fields in body is required:
{
name, // STRING
description, // STRING
price, // INT
img, // STRING
is_perishable // BOOLEAN
}
PATCH /api/snacks/:id/reviews/:id
- at least one(1) of the following fields in body is required:
{
title, // STRING
text, // STRING
rating, // INTEGER
}
DELETE /api/snacks/:id
DELETE /api/snacks/:id/reviews/:id