Code Monkey home page Code Monkey logo

goscawa's Introduction

goscawa

A simple go web api example applying clean architecure for working out Go

  • As simple as possible
  • Gin as dependency
  • No surprise
  • Extensible

Largely inspired by Mat Ryer videos on how he writes web API and Clean Architecture principles practices gathered along my career.

Specification and domain

For demonstration purpose, the web API allows to found the nearest waste disposal near your home.

Note: for France only ;).

For this will use ADEME directory of waste disposal center web site service. ADEME is the French Ecological Transition Agency.

A OpenAPI definition is provided here api_docs.

Use cases

  • A client searching for the nearest waste disposal center send a request to /waste-disposal/api/nearest with its geo coordinates. The web api, first request to ADEME gateway necessary informations to compute the nearest center.

Domain

  • WasteDisposalCenter
  • GeoLocation
  • FindNearest

External System

  • An adapter to ADEME API

Build

make build

Will create an executable named server in bin/ folder.

With Docker:

./scripts/build_image.sh

An image named goscawa will be build.

Run

make run

To test it:

curl localhost:8080?name=Dude

Deploy on K8S

Tested with minikube.

Make you docker client point to run in minikube environment with:

eval $(minikube docker-env)

Build your image:

./scripts/build_image.sh

Deploy it:

minikube kubectl -- apply -f build/package/deployment.yaml

goscawa's People

Contributors

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