Skip to content

jmptrader/go-webapp-skeleton

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

12 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

go-webapp-skeleton

This repo contains a skeleton of a Go webapp. It has some useful features, mostly cribbed from other, similar projects around the Internet:

All tied together with a useful set of tooling. See below for more information.

Usage

  1. Clone this repository into your project's location:
    git clone https://github.com/andrew-d/go-webapp-skeleton.git $GOPATH/github.com/your-user/your-project
  2. Run the rename.sh script in order to rename this project and point it at the new import path.
  3. Type make clean all in order to clean the project and rebuild it.
    Note: you need go-bindata installed and in your $PATH in order for the build to complete.

Tooling

This project uses gvt in order to manage dependencies. It comes with all the dependencies already vendored as part of the repository. In order to update a given dependency, you can run gvt update path/to/dep.

Organization

Note: somewhat of a work in progress

  • The base of the project can be found in the main.go file, which imports most of the other packages and kicks everything off. You probably won't need to modify this as much.
  • The model directory contains database models. These models should not interact directly with the database.
  • The datastore directory is responsible for mapping the models to the database in use. It defines interfaces which provide the interface to interact with the underlying, concrete, datastore.
  • The datastore/database directory contains the actual code that is responsible for interacting with the underlying database.
  • The datastore/migrate directory contains the SQL code for migrations performed by the app upon startup.
  • The handler directory contains useful functions that are generic between API and frontend routes.
  • The handler/api directory contains the API route handler functions.
  • The handler/frontend directory contains the frontend route handler functions.
  • The router directory contains the main router, which registers each of the handler functions on their respective routes.

About

Skeleton of a Go webapp with an API, DB, migration, static file and template support.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Go 89.5%
  • Makefile 6.7%
  • Shell 3.8%