Site icon Flutter Packages | Pub dev Packages – Flutter Mobile App World

Gobook is a golang boilerplate with web framework Gin & Gorm ORM

Gobook

Gobook is a golang boilerplate with web framework Gin & Gorm ORM.

Features:

Installing

  1. Setup gobook bash using command
wget https://leeyurani.com/gobook.sh
chmod +x gobook.sh
./gobook.sh setup
alias gobook='$HOME/gobook.sh'
  1. Make sure your GOPATH and GOROOT already defined. This is an example of my path:
export GOROOT=/usr/local/go
export GOPATH=/Volumes/YURANI/Software\ Development/Golang
export PATH=$PATH:$GOROOT/bin:$GOPATH

GOROOT is the place where you install the golang software, and GOPATH is the place your golang project stored

  1. Install required library
gobook install
  1. Setup your .env Database Credentials
  2. Migrate your model using command
gobook migrate

How To Add New Library

gobook install <packagename>

Example command

gobook install github.com/google/uuid

How To Add New Model

  1. Use this following command to make a new model
gobook make model <name>
  1. Migrate your database using command
gobook migrate

How To Add New Controller

  1. Use this following command to make a new controller
gobook make controller <name>

Database Setup

We use .env file to keep the configurations, just open the .env file and edit your database credentials here

Using MySQL

DB_CONNECTION=mysql
DB_HOST=127.0.0.1
DB_PORT=3306
DB_USERNAME=root
DB_PASSWORD=password
DB_NAME=gobook

Using PostgreSQL

DB_CONNECTION=postgres
DB_HOST=127.0.0.1
DB_PORT=5432
DB_USERNAME=postgres
DB_PASSWORD=password
DB_NAME=gobook

Commands

Start server using

gobook start

Migrate Database

gobook migrate

Install Required Package

gobook install <packagename>

Make New Controller

gobook make controller <name>

Make New Model

gobook make model <name>

Show Help

gobook help

Postman Collection

Check this collection if you want to see the example requests Gobook Collection

Download Gobook source code on GitHub

https://github.com/yusriltakeuchi/gobook

Exit mobile version