apigoboot

module
v0.0.0-...-d933f62 Latest Latest
Warning

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

Go to latest
Published: Mar 23, 2018 License: MIT

README

ApiGoBoot - WIP - Looking for inputs & code reviews! 🚀❤️️🚀❤️🚀

Go Report Card Build Status Coverage Status GoDoc

This is a playground for a boilerplate API in Go using a micro service oriented architecture. The architecture will be updated depending on what I'll be reading/learning on the web.

Set up
Start
$ docker network create apigoboot_network
$ docker-compose up
Return values

The API return user friendly error message that can be printed directly client-side. The errors are always using the same nomenclature.

{
    "Errors": [
        {
            "param": "last_name",
            "detail": "The field last_name is required",
            "message": "Please complete this field"
        },
        {
            "param": "email",
            "detail": "The field email is required",
            "message": "Please complete this field"
        }
    ]
}

An Errors array is returned composed of objects including the faulty param and a detail human readable sentence to describe each error.

When an error happen during the request process but that the submitted request pass the validation, a more detailed error will be returned:

{
    "Errors": [
        {
            "status_code": 1003,
            "title": "Operation scheduled_date malformed",
            "detail": "The field scheduled_date need to use the 2006-12-31 format",
            "message": "Please use the 2006-12-31 format"
       }
    ]
}

Directories

Path Synopsis
package main
package main
config
Package config generate the environment of the API
Package config generate the environment of the API
core
Package core init the api gateway
Package core init the api gateway
rest
Package rest implement routes
Package rest implement routes
api-tool
errorhandling/apihelper
Package apihelper automate construction of http response
Package apihelper automate construction of http response
errorhandling/servicehelper
Package servicehelper structure the construction of errors generated by services
Package servicehelper structure the construction of errors generated by services
gentool
Package gentool add string generation, modification and conversion capabilities
Package gentool add string generation, modification and conversion capabilities
oauth2-micro-service
component
Package main
Package main
component/oauth2
Package oauth2 handle Authentication with OAuth2.0
Package oauth2 handle Authentication with OAuth2.0
component/oauth2/repo
Package repo implement the function that contact the db required by the service package
Package repo implement the function that contact the db required by the service package
component/oauth2/rest
Package rest implement the callback required by the oauth2 package
Package rest implement the callback required by the oauth2 package
component/oauth2/service
Package service implement the services required by the rest package
Package service implement the services required by the rest package
config
Package config generate the environment of the API
Package config generate the environment of the API
database/dbconn
Package dbconn allows connection to db
Package dbconn allows connection to db
profile-micro-service
component
Package main
Package main
component/profile
Package profile is a component to manage the profile of a user
Package profile is a component to manage the profile of a user
component/profile/repo
Package repo implement the function that contact the db required by the service package
Package repo implement the function that contact the db required by the service package
component/profile/rest
Package rest implement the callback required by the profile package
Package rest implement the callback required by the profile package
component/profile/service
Package service implement the services required by the rest package
Package service implement the services required by the rest package
config
Package config generate the environment of the API
Package config generate the environment of the API
database/dbconn
Package dbconn allows connection to db
Package dbconn allows connection to db
user-micro-service
component
Package main
Package main
component/user
Package user is a component to manage a user
Package user is a component to manage a user
component/user/repo
Package repo implement the function that contact the db required by the service package
Package repo implement the function that contact the db required by the service package
component/user/rest
Package rest implement the callback required by the user package
Package rest implement the callback required by the user package
component/user/service
Package service implement the services required by the rest package
Package service implement the services required by the rest package
config
Package config generate the environment of the API
Package config generate the environment of the API
database/dbconn
Package dbconn allows connection to db
Package dbconn allows connection to db

Jump to

Keyboard shortcuts

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