Giter Site home page Giter Site logo

go-web-skeleton's Introduction

github.com/windstep/go-web-skeleton

Simple and clean web template for golang web programming. This boilerplate / skeleton takes care of basic logging, routing (middleware + route), configuration, and basic database connection and dockerizing an app.

how to use

Simply clone this repo, rename package name into your's name and start docker (just replace github.com/windstep/go-web-skeleton in go.mod file and in all project files).

use with docker

docker-compose up --build go or docker build . -t project:latest && docker run project:latest

There is a database included into docker-compose file, so you can generally use it.

what involved?

main.go is your entrance point. It just creates logger and config and starts app/server.go.

server.go starts new gorilla/mux router, which is filled of routes from router/router.go

router.go uses routes from router/routes/routes.go (and others). Pay your attention of how does middleware used.

Look on SetupRoutesWithMiddleware method of routes.go file. It uses middleware chain, which is defined in middleware/middleware_chains.go. You can easily extend this chains for individual routes in Route declaration, just using your own chain or extending default one.

Your controllers may be anywhere, but I generally prefer to place them in api_controllers or controllers directories.

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.