Git Product home page Git Product logo

go-rest-api-boilerplate's Introduction

GoLang Rest API Boilerplate

This is the rest api boiler plate built in GoLang. It will help you kick start your next REST API project quickly. It supports authorization and JWT tokens.

Setup

  • Checkout project in $GOPATH/src/github.com/writetosalman/go-rest-api-boilerplate folder.

  • It requires Mysql database.

  • It requires following commands to run to setup dependencies

go get github.com/gorilla/context
go get github.com/gorilla/mux
go get github.com/subosito/gotenv
go get github.com/go-sql-driver/mysql
go get github.com/dgrijalva/jwt-go
go get golang.org/x/crypto/bcrypt
go get golang.org/x/net/context
  • Create MySQL database and run SQL files in the __SQL folder to create necessary tables.

  • Copy .env.example as .env

  • Edit .env and enter port and MySQL connection string based on your system information.

Deployment

To run in dev, run command

go run main.go

Production

To run in production, run command

go build main.go
chmod +x main
nohup ./main &> main.log &

To kill it, just run kill -9 <pID>

Future Plans

  • Write tests. Should have been written with dev but I was in hurry to put things together.

  • Refactor utilities so that different functions are in their separate package. Right now it is bit hotchpoch.

  • Built support for 2FA.

  • More SQL databases support.

go-rest-api-boilerplate's People

Contributors

writetosalman 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.