https://github.com/cauabernardino/go-rest-api
An API written in Go, with Mux for routing and PostgreSQL as database.
https://github.com/cauabernardino/go-rest-api
go golang postgresql rest-api
Last synced: 6 months ago
JSON representation
An API written in Go, with Mux for routing and PostgreSQL as database.
- Host: GitHub
- URL: https://github.com/cauabernardino/go-rest-api
- Owner: cauabernardino
- License: mit
- Created: 2021-05-21T20:49:37.000Z (about 5 years ago)
- Default Branch: main
- Last Pushed: 2021-05-26T00:07:57.000Z (about 5 years ago)
- Last Synced: 2024-06-19T16:43:26.870Z (about 2 years ago)
- Topics: go, golang, postgresql, rest-api
- Language: Go
- Homepage:
- Size: 24.4 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Go Rest API
An API written in Go, with Mux for routing and PostgreSQL as database.
The example endpoint is `/products`. The structure of a product is:
```json
{
"id": "6a9b6882-2838-4da2-ac90-83419f146135",
"name": "Keychron K2",
"price": 79.99,
"description": "Keychron K2 is a 75% layout (84-keys) white led backlit compact Bluetooth mechanical keyboard.",
"created_at": "2021-05-23T23:14:29.517606Z"
}
```
## Dependencies
- Go v1.16+
- Docker
- Docker-compose v1.29+
- [Migrate](https://github.com/golang-migrate/migrate)
## How To Run
### Postgres
- Create Postgres container with: `make postgres`
- To drop the container: `make postgresdown`
### Tests
- For running tests: `make test`
### Development Environment
- Create development database with: `make devdbup`
- Run server with: `go run main.go`
## Functionalities:
- [x] Database package tests
- [x] Database connection and repositories
- [x] Models package tests
- [x] Product models
- [x] HTTP Handlers functions
- [ ] HTTP Handlers tests