All Projects → wahyuhadi → go-iris-mv

wahyuhadi / go-iris-mv

Licence: other
No description or website provided.

Programming Languages

go
31211 projects - #10 most used programming language
Dockerfile
14818 projects

Projects that are alternatives of or similar to go-iris-mv

spe
A series of PHP8 examples based around a super simple MVC framework (WIP)
Stars: ✭ 14 (-33.33%)
Mutual labels:  mvc
NasdaqCloudDataService-SDK-Java
Nasdaq Data Link provides a modern and efficient method of delivery for real-time exchange data and other financial information. This repository provides a Java SDK for developing applications using Nasdaq Data Link's real-time data.
Stars: ✭ 70 (+233.33%)
Mutual labels:  restapi
AI-Image-classifiers-on-Django-with-RESTAPI
A Keras deep learning image classifiers on Django server with REST API | Django 图片识别平台
Stars: ✭ 28 (+33.33%)
Mutual labels:  restapi
foodfy
MVC application to explore, manage recipes and chefs - built with Express, Nunjucks, and Postgres
Stars: ✭ 121 (+476.19%)
Mutual labels:  mvc
Core-iOS-Application-Architecture
Core iOS Application Architecture - The development paradigm of clean, testable code and modular iOS applications. + Xcode templates
Stars: ✭ 123 (+485.71%)
Mutual labels:  mvc
webpack-starter
'Just Add Water' Webpack 2, babel and glslify gourmet mix.
Stars: ✭ 13 (-38.1%)
Mutual labels:  starter-kit
trac-nghiem-online
Xây dựng hệ thống trắc nghiệm online cho các trường THCS, THPT một cách nhanh chóng và dễ dàng. Không cần phải là lập trình viên
Stars: ✭ 64 (+204.76%)
Mutual labels:  mvc
adminlte-aspnetcore2-version
Asp.Net Example version of famous and beautiful AdminLTE control panel themes and template.
Stars: ✭ 64 (+204.76%)
Mutual labels:  mvc
progressive-web-app-starter
Preact based starter kit for making a Progressive Web App (PWA).
Stars: ✭ 19 (-9.52%)
Mutual labels:  starter-kit
api
Free Rest Webservices
Stars: ✭ 20 (-4.76%)
Mutual labels:  restapi
Simplify.Web
Moved to https://github.com/SimplifyNet. Simplify.Web is a lightweight and fast server-side .NET web-framework based on MVC and OWIN for building HTTP based web-applications, RESTful APIs etc.
Stars: ✭ 23 (+9.52%)
Mutual labels:  mvc
grapevine
Fast, unopinionated, embeddable, minimalist web framework for .NET
Stars: ✭ 72 (+242.86%)
Mutual labels:  restapi
nextjs-woocommerce-restapi
A React WooCommerce Project Example With REST API
Stars: ✭ 168 (+700%)
Mutual labels:  restapi
YaNi
【毕设】基于Bmob第三方后端云+MVC框架模式的商城项目
Stars: ✭ 63 (+200%)
Mutual labels:  mvc
commercejs-chopchop-demo
A Commerce.js starter kit for Next.js. A beautifully designed elegantly developed, end to end commerce experience for developers and agencies. Pre-integrated with Stripe. One-click deploy to Vercel.
Stars: ✭ 129 (+514.29%)
Mutual labels:  starter-kit
ReaLocate
ASP.NET MVC 5 Real Estate Application
Stars: ✭ 18 (-14.29%)
Mutual labels:  mvc
fractal-starter-kit
Starter kit for Fractal with SCSS, Webpack, XO, sass-lint and Gulp
Stars: ✭ 22 (+4.76%)
Mutual labels:  starter-kit
node-react-starter-kit
A quick starter kit to bootstrap NodeJS/ReactJS app
Stars: ✭ 27 (+28.57%)
Mutual labels:  starter-kit
MvcSimplePager
Simple,lightweight,easy to expand pager for asp.net mvc and asp.net core,针对asp.net mvc 和 asp.net core 设计的通用、扩展性良好的轻量级分页扩展
Stars: ✭ 13 (-38.1%)
Mutual labels:  mvc
mvp-sample
一个简单的MVP示例,和传统不一样的是,我们把Activity/Fragment作为Presenter,把View单独提出来,扩展了Presenter的能力。
Stars: ✭ 41 (+95.24%)
Mutual labels:  mvc

MVC iris golang starter

Depedency

Install dep

	$ curl https://raw.githubusercontent.com/golang/dep/master/install.sh | sh
	$ dep ensure -update
	$ rm -irf vendor/ # There's still bug on go dep for macOS, you should omit / remove completely the vendor directory

Setting Env

Buat file .env berdasarkan file ENVIRONMENT_EXAMPLE

Membuat Model

Untuk membuat model , masuk ke folder model dian buat file namamodel.go, Lihat contoh

package model

import (
	"time"
)

type User struct {
	ID int `json:"id" gorm:"primary_key"`

	FirstName string     `json:"firstname, omitempty" gorm:"not null; type:varchar(100)"`
	LastName  string     `json:"lastname, omitempty" gorm:"not null; type:varchar(100)"`
	Email     string     `json:"email, omitempty" gorm:"not null; type:varchar(100)"`
	CreatedAt *time.Time `json:"createdAt, omitempty"`
	UpdatedAt *time.Time `json:"updatedAt, omitempty"`
	DeletedAt *time.Time `json:"deletedAt, omitempty" sql:"index"`
}

func (User) TableName() string {
	return "users" // table name when succesfully migrate
} 

untuk lebih jelasnya silahkan baca documentasi Gorm Model

Setting Migrate

Untuk setting automigrate bisa di lihat pada main.go pada fungsi AutoMigrate

func DBMigrate() {
fmt.Println("[::] Migration Databases .....")
db := config.GetDatabaseConnection() // check connection to Databases
db.AutoMigrate(&model.User{})        // Migrate Model
//db.AutoMigrate(&model.Profile{})        // Migrate Model
....
fmt.Println("[::] Migration Databases Done")
}

Setting Route

untuk membuat router silahkan ke folder router ke function Routers

func Routers() {
	db := config.GetDatabaseConnection()
	inDB := &controller.InDB{DB: db }
	app := iris.Default()
	// for / endpoint
	app.Get("/", controller.WelcomeController)

	// example group: v1
	v1:= app.Party("/v1")
	{
		v1.Post("/user", inDB.CreteUser)
		v1.Get("/user", inDB.GetAll)
		v1.Get("/user/{id : int}", inDB.GetById)
		v1.Put("/user/{id : int}", inDB.UpdateUser)
		v1.Delete("/user/{id : int}", inDB.DeleteUser)
	}

app.Run(iris.Addr( ":"+os.Getenv("API_PORT"))) // starter handler untuk route
}

Untuk lebih jelasnya silahkan baca documentasi iris router

Cara running program

go run main.go // untuk running
go build main.go // untuk build

Apidocs

go-iris-mv/apidoc/index.html adalah hasil generate automatis

pada tahap development bisa digunakan , namun ketika tahap production, recomendasi untuk di hapus. Lokasi pada foler router - > router.go

//---------------------------------------------------
// myXML digunkan untuk generate apidocs
//---------------------------------------------------
type myXML struct {
	Result string `xml:"result"`
}
//---------------------------------------------------
//  anda bisa menghapus ini jika sudah tahap production
//	modul ini digunakan untuk generate apidoc
//---------------------------------------------------
yaag.Init(&yaag.Config{ // <- IMPORTANT, init the middleware.
	On:       true,
	DocTitle: "Iris",
	DocPath:  "apidocs/index.html",
	BaseUrls: map[string]string{"Production": "", "Staging": "", "Development": "localhost:3000"},
})
app.Use(irisyaag.New())

Folder Architecture

├── apidocs 
│   ├── index.html // hasil generate
│   └── index.html.json
├── config
│   └── database.go // setting connection database
├── controller // folder binis proses
│   ├── RequestController // logic untuk request
│   │   └── HttpReqController.go 
│   ├── UserController // logic untuk user
│   │   ├── UseCase
│   │   │   └── UserCase.go // self query untuk user
│   │   └── UserController.go // user controller
│   └── WelcomeController.go
├── Dockerfile
├── ENVIRONMENT_EXAMPLE 
├── Gopkg.lock // depedency
├── Gopkg.toml
├── main.go
├── middleware
│   ├── JwtToken.go // middleware untuk jwt
│   └── TestMilddleware.go
├── model // folder untuk models
│   ├── autogenerated_profile.go
│   ├── autogenerated_user.go
│   ├── profile.go
│   └── user.go 
├── README.md
├── router
│   └── routes.go
└── service
    ├── HashPassword.go
    ├── HttpReq.go
    └── QueryService.go // global service query

Contact

email : [email protected], rahmat wahyu hadi

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].