Skip to content

browny/goweb-scaffold

Repository files navigation

goweb-scaffold

GoDoc Travis Build Status Coverage Status MIT licensed

A template golang web project built with love 💘

Local Dev

  1. Assume your environment with golang installed (For Mac: brew install go)
  2. Cloen this repository to your $GOPATH/src
  3. Install depedencies
make deps
  1. Run http server
go run main.go
  1. Run test
make test

Use Docker to run it

  1. Assume your environment equipped with Docker (ie. docker ps works)
  2. Run below shell script, you will find 2 containers running for you (nginx is proxy, goweb-xxx is the scaffold app)
sh scripts/docker-run.sh

// If above succeeds, you will get below
$ docker ps
CONTAINER ID        IMAGE               COMMAND                  CREATED             STATUS              PORTS                                      NAMES
49d938a04188        nginx-proxy         "/app/docker-entrypoi"   38 minutes ago      Up 38 minutes       0.0.0.0:80->80/tcp, 0.0.0.0:443->443/tcp   nginx
5745797c3caa        goweb-scaffold      "/go/bin/goweb-scaffo"   38 minutes ago      Up 38 minutes       0.0.0.0:28983->28983/tcp                   goweb-0310-1457577308

Docker Dev

  1. Make sure your system with Docker installed (check how)

  2. Pull docker images (this takes seconds)

docker pull browny/go-docker-dev
  1. Clone the source code
git clone git@github.com:browny/goweb-scaffold.git
  1. Run the container under the source root
docker run --rm -it -v `pwd`:/go/src/goweb-scaffold -p 8000:8000 browny/go-docker-dev
  1. Inside the container, cd into /go/src/goweb-scaffold, then install dependencies (few minutes)
cd /go/src/goweb-scaffold;
make deps
  1. Here your go
// test inside container
make test

// run app inside container
go run main.go

Start project from this scaffold

  1. Change the package name
  • Linux

    grep -rl  --exclude-dir=".git" goweb-scaffold . | xargs sed -i 's/goweb-scaffold/your-name/g'
  • Mac

    grep -rl  --exclude-dir=".git" goweb-scaffold . | xargs sed -i '' -e 's/goweb-scaffold/your-name/g'
  1. Reset the git upstream url

    git remote set-url origin <your project git repository url>

About

The scaffold project for go web application

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published