Git Product home page Git Product logo

myapp's Introduction

Learning Cloud Native Go - myapp

Cloud Native Application Development is a one way of speeding up building web applications, using micro-services, containers and orchestration tools.

As the first step, this repository shows How to build a Dockerized RESTful API application using Go.

πŸ’‘Refer learning-cloud-native-go.github.io or commit messages and step- branches for a step by step guild.

Points to Highlight

πŸ’­ Hope to use Wire for Compile-time Dependency Injection in the future.

Endpoints

endpoints

Docker Image Sizes

REPOSITORY                 TAG                 SIZE
myapp_app                  latest              58.7MB
myapp_db                   latest              233MB

Design Decisions & Project Folder Structure

  • Store Docker related files inside the docker folder. But keep the docker-compose.yml file in the project root.
  • Store executable packages inside the cmd folder.
  • Store database migrations inside the migrations folder.
  • Store main application code inside the app folder.
  • Store reusable packages like configs, utils, models and repositories in separate folders. This will be helpful if you are adding more executable applications to support web front-ends, publish/subscribe systems, document stores and etc.
.
β”œβ”€β”€ docker
β”‚  β”œβ”€β”€ app
β”‚  β”‚  β”œβ”€β”€ bin
β”‚  β”‚  β”‚  β”œβ”€β”€ init.sh
β”‚  β”‚  β”‚  └── wait-for-mysql.sh
β”‚  β”‚  └── Dockerfile
β”‚  └── mariadb
β”‚     └── Dockerfile
β”œβ”€β”€ docker-compose.yml
β”‚
β”œβ”€β”€ cmd
β”‚  β”œβ”€β”€ app
β”‚  β”‚  └── main.go
β”‚  └── migrate
β”‚     └── main.go
β”‚
β”œβ”€β”€ migrations
β”‚  └── 20190805170000_create_books_table.sql
β”‚
β”œβ”€β”€ app
β”‚  β”œβ”€β”€ app
β”‚  β”‚  β”œβ”€β”€ app.go
β”‚  β”‚  β”œβ”€β”€ book_handler.go
β”‚  β”‚  β”œβ”€β”€ health_handler.go
β”‚  β”‚  └── index_handler.go
β”‚  β”œβ”€β”€ requestlog
β”‚  β”‚  β”œβ”€β”€ handler.go
β”‚  β”‚  └── log_entry.go
β”‚  └── router
β”‚     β”œβ”€β”€ middleware
β”‚     β”‚  β”œβ”€β”€ content_type_json.go
β”‚     β”‚  └── content_type_json_test.go
β”‚     └── router.go
β”‚
β”œβ”€β”€ config
β”‚  └── config.go
β”‚
β”œβ”€β”€ adapter
β”‚  β”œβ”€β”€ db
β”‚  β”‚  └── db.go
β”‚  └── gorm
β”‚     └── gorm.go
β”‚
β”œβ”€β”€ util
β”‚  β”œβ”€β”€ logger
β”‚  β”‚  β”œβ”€β”€ logger.go
β”‚  β”‚  └── logger_test.go
β”‚  └── validator
β”‚     └── validator.go
|     └── validator_test.go
β”‚
β”œβ”€β”€ model
β”‚  └── book.go
β”œβ”€β”€ repository
β”‚  └── book.go
β”‚
β”œβ”€β”€ go.mod
└── go.sum

πŸ’‘About app/app/app.go; Some prefer app/server/server.go or http/app/app.go

Form Validation

Form validation

Logs

Logs in app init Logs in crud

myapp's People

Contributors

dumindu avatar

Watchers

James Cloos avatar  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.