Coder Social home page Coder Social logo

todo-go-api's Introduction

TODO Go API

Simple Todo list Go server. Uses Go and PostgreSQL

API documentation

See openapi.yaml.

Local setup

Golang linters

Install golangci-lint:

brew install golangci-lint

PostgreSQL

You will need psql binary. On MacOS install it via homebrew:

brew install libpq

Development

Local build

# install build and development dependencies
make prepare
# build app
make

Local run

The following command will create and run detached Docker containers running a PostgreSQL database with an Adminer instance

# start containers
docker compose up -d
# setup database
make reset-db
# start server
make run-server
# shutdown
docker compose down

Database

Initial setup

When the local PostgreSQL database is empty or brand new, run the following script to create the schema:

docker-compose up -d
make reset-db

Create a new migration

tern -m database/iban/migrations new <name>

Migrate to latest version

make migrate-up

Testing database migrations locally

# migrate one version up
tern migrate -c database/migrations/tern.conf -m database/migrations -d +1

# migrate one version down
tern migrate -c database/migrations/tern.conf -m database/migrations -d -1

# migrate one version up again
tern migrate -c database/migrations/tern.conf -m database/migrations -d +1

If no error occurred, then the migration is fine.

Testing

Unit tests

No setup required.

make unit

Integration tests

Requires a full local setup.

docker-compose up -d
make integration

todo-go-api's People

Contributors

iciantoine avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.