apptemplate

package module
v0.0.0-...-a4dbabe Latest Latest
Warning

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

Go to latest
Published: Jun 14, 2020 License: MIT Imports: 0 Imported by: 0

README

Default Application template

Test project to build simple RESTful service based on OpenApi definitions defined in /api directory.

TODOs

  • Configuration with Viper
  • Add support for flags (cobra?)
  • Version tags / Build info
  • Containerization
  • OpenApi code generation
  • REST server using echo.Echo
  • Middleware for REST endpoints
  • Picking structured logging library
  • Dummy Frontend SPA
  • Single Binary deployment with embedded SPA
  • Persistence storage
  • SearchStore capabilities

Directory layout

Directory Description
./.iac "infrastructure as code"
./api OpenAPI, gRPC contracts
./bin/<arch> Build output directory, grouped by architecture (eg: darwin, linux)
./cmd application main
./config application specific configuration
./internal project private libraries
./pkg project libraries
./scripts Shell scripts used in dev environment (env setup, automation etc)
./ui frontend as Single Page Application

Prerequisites

Minimum

  • Go 1.14+
  • Go Modules

Recommended

  • Git (SCM)
  • Docker (containerization)
  • Unix based system (for scripts execution)
  • Javascript with React (for UI component development)
  • yarn (frontend package manager)
  • developer tools binaries installed on host

Installation

Image build
gomodroot=$(go list -m)
buildTime=$(date -u '+%Y-%m-%d %H:%M:%S %Z') && \
docker build \
  --build-arg VERSION=$(git describe --tags --always --dirty) \
  --build-arg GIT_COMMIT=$(git rev-list -1 HEAD) \
  --build-arg BUILD_TIME=$buildTime \
  --build-arg GO_MOD_ROOT=$gomodroot \
  -t macpla/test .
Docker run
Local build

Interacting with a Service

Developer tools

deepmap/oapi-codegen - OpenAPI 3 client and server boilerplate generator for GO

mikefarah/yq - cli YAML preprocessor

openapi-generator-cli - all purpose node based OpenAPI generator used to generate frontend client

markbates/pkger - static files to Go embedding processor

Documentation

Overview

Package apptemplate test.

Directories

Path Synopsis
cmd
pkg
demoapp/rest
Package restv1 provides primitives to interact the openapi HTTP API.
Package restv1 provides primitives to interact the openapi HTTP API.
spa

Jump to

Keyboard shortcuts

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