Coder Social home page Coder Social logo

go-api's Introduction

go-api

Main purpose

This project is an example of a quick-start project developed in golang, exposing a rest API

Technical details

The rest api is exposed using gin

The application is deliver through a docker image.

Two docker images:

  • one based on the official golang image for the build part and and deployed on a distroless one.
  • one based on a distroless image in order to reduce image size.

debug

Install delve :

go get -u github.com/go-delve/delve/cmd/dlv

use this command :

dlv debug --headless --listen=:2345 --api-version=2 --accept-multiclient

build project

In order to build project, as usual bash build.sh

Launch tests

In order to launch all tests : go test ./...

If you need to launch one specific test : go test -run path/to/file_test.go

Docker commands

run docker

docker-compose up -d from the package folder

How to test it

get state

curl  http://localhost:8080/info

Generate mocks

In order to generate mock, we use Mockery.

First install it : go install github.com/vektra/mockery/[email protected]

Then generate mock into src folder using the following command

mockery

go-api's People

Contributors

valentinconan 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.