go-rest-api

command module
v0.0.0-...-1ee42d9 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 26, 2021 License: MIT Imports: 11 Imported by: 0

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:

{
  "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

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:

  • Database package tests
  • Database connection and repositories
  • Models package tests
  • Product models
  • HTTP Handlers functions
  • HTTP Handlers tests

Documentation

The Go Gopher

There is no documentation for this package.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL