https://github.com/andyatkinson/freezer-backend
Add (a description of) stuff to my freezer!
https://github.com/andyatkinson/freezer-backend
echo-framework golang
Last synced: about 1 year ago
JSON representation
Add (a description of) stuff to my freezer!
- Host: GitHub
- URL: https://github.com/andyatkinson/freezer-backend
- Owner: andyatkinson
- Created: 2020-04-20T18:57:05.000Z (about 6 years ago)
- Default Branch: master
- Last Pushed: 2020-04-28T18:47:47.000Z (about 6 years ago)
- Last Synced: 2023-04-21T00:09:35.979Z (about 3 years ago)
- Topics: echo-framework, golang
- Language: Go
- Homepage:
- Size: 5.68 MB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
## Freezer Backend
Backend service using [Golang Echo](https://echo.labstack.com/)
Currently this only works in a local development environment.
### Local Development
Running locally:
```
go run server.go
```
### Dependencies
Using Go modules
### Data Seeding
* `create database freezer_development`
* Gorm is responsible for migrating the database
* The following seed data can be manually inserted. Gorm manages various additional columns about objects.
```
insert into items (name, added_on) VALUES ('Lasagna for 4 (4)', '2020-02-01');
insert into items (name, added_on) VALUES ('Frozen peas, 1 bag (8 oz.)', '2020-03-01');
insert into items (name, added_on) VALUES ('Popsicles (box) (8)', '2020-04-01');
```
## API
#### Listing Items
```
$ curl -H 'Content-Type: application/json' localhost:1323/items
```
#### Creating Items
As a JSON payload
```
curl -d '{"name":"Chicken Nuggets","addedOn":"2020-01-01"}' -H 'Content-Type: application/json' localhost:1323/items
```
## Heroku
Set Go version
```
heroku config:set GOVERSION=go1.9
```