Skip to content

Latest commit

 

History

History
98 lines (80 loc) · 1.69 KB

README.md

File metadata and controls

98 lines (80 loc) · 1.69 KB

Golang Api Framework

This template should help get you started developing with Golang

Current Project is Based on Gorm and Gin-Gonic

Project Setup (With out CLI)

Clone project and run

go get

Project Setup (With CLI)

Install Cli

go install "github.com/usama-tariq1/leet-astro@latest"

Test Cli

leet-astro

Create project

leet-astro init ProjectName "ModUser"

example

leet-astro init Test "github.com/usama-tariq1"

assuming go 1.18 or greater is already installed on system

Install Dependencies

go get

Database Config .env

copy .env.example and make .env file fill in Database configs

Compile with

This will also create migrations in database if tables are not already created

With Cli

leet-astro serve

With Out Cli

go run main.go

note that project does not support hot reload

Cli Create Commands

Create Controller

With Resource and methods already built

leet-astro create controller ControllerName --model=ModelName

With out methods

leet-astro create controller ControllerName

Create Model

create just model with query methods

leet-astro create model ModalName

With controller auto generated

leet-astro create model Name --controller=true

With controller and router auto generated

leet-astro create model Name --controller=true --router=true

Create Router

leet-astro create router NameRouter

Create Middleware

leet-astro create middleware Name

Router functions , http and response handling Docs

Gin-Gonic Docs.

Database and ORM Docs

GORM Docs.