Skip to content

scrabblett/simple-golang-api

Repository files navigation

Books library API

It's a simple api, representing books library. Written in Go.

Deployement

By default, http-server starts on http://localhost:8080.

API routes available by path /api/v1

Example: http://localhost:8080/api/v1/auth/login

In Docker container

  1. Install Docker
  2. Run docker-compose up

Locally

  1. Install Go 1.22
  2. Install Postgres and create new database
  3. Run migrations :
cd migrations/scripts
goose postgres <connection_string> up

Example:

goose postgres postgres://postgres:12345@localhost:5432/books_library?sslmode=disable up 
  1. By default, configs take from env variables. Env-config is here. Set variables in your system.
  2. If env-variables not set, config takes default values
  3. Run go run ./cmd/app/main.go

Running tests

  1. Run go test ./... -coverprofile cover.out
  2. Generate test-coverage in html (need go cover installed) go tool cover -html cover.out

Swagger

Swagger is here

  1. Go to swagger-editor
  2. Paste content of swagger.yaml in editor

About

Simple API for load tests. Written in Go

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published