Skip to content

karansinghgit/letsgo-mux

 
 

Repository files navigation

letsgo-mux

Join the chat at https://gitter.im/letsgo-framework/community

Go api starter

Ingredients


Directory Structure

By default, your project's structure will look like this:

  • /controllers: contains the core code of your application.
  • /database: contains mongo-go-driver connector.
  • /helpers: contains helpers functions of your application.
  • /middlewares: contains middlewares of your application.
  • /routes: directory contains RESTful api routes of your application.
  • /tests: contains tests of your application.
  • /types: contains the types/structures of your application.

Environment Configuration

letsGo uses godotenv for setting environment variables. The root directory of your application will contain a .env.example file. copy and rename it to .env to set your environment variables.

You need to create a .env.testing file from .env.example for running tests.


Setting up

  • clone letsGo
  • change package name in go.mod to your package name
  • change the internal package (controllers, tests, helpers etc.) paths as per your requirement
  • setup .env and .env.testing
  • run go mod download to install dependencies

OR letsgo-cli can be used to setup new project

install letsgo-cli

go get github.com/letsgo-framework/letsgo-cli

Create a new project

letsgo-cli init <import_namespace> <project_name>
  • letsgo-cli init github.com myapp
    Generates a new project called myapp in your GOPATH inside github.com and installs the default plugins through the glide.

Run : go run main.go


Build : go build


Test : go test tests/main_test.go

Coverall :

go test -v -coverpkg=./... -coverprofile=coverage.out ./...

goveralls -coverprofile=coverage.out -service=travis-ci -repotoken $COVERALLS_TOKEN

Authentication

letsgo uses Go OAuth2 (https://godoc.org/golang.org/x/oauth2) for authentication.


Deploy into Docker

sudo docker run --rm -v "$PWD":/go/src/github.com/letsgo-framework/letsgo -w /go/src/github.com/letsgo-framework/letsgo iron/go:dev go build -o letsgo
sudo docker build -t sab94/letsgo .
sudo docker run --rm -p 8080:8080 sab94/letsgo

About

letsgo with mux router

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • HTML 54.3%
  • Go 45.2%
  • Dockerfile 0.5%