iFTY Is A HTTP Web Framework Written In Go (Golang). It Based On FastHTTP 10x Faster Than net/http
Most Golang Fans Written PHP Many Years, When First Change Their Coding Behavior And Habit, Pain Can Only Be Feeled. Completely Ignoring The Advantages Of Golang Itself.
So, We Need A Framework That Keep the features of PHP language Framework.
Now, iFTY Comes!
- Based On
FastHTTP, 10X Faster Thannet/http - Use
Go ModManage Packages - Support
RouterAndMiddleWare - Support ENV file
- Support
CSMStructure, Controller(C), Service(S), Model(M) - Strong early warning mechanism (DB, Cache, Script, Error)
- Write Golang Code Just Like PHP
Install From Github
go get github.com/wk331100/iFTY
Install From Official Website
Config File config/server.go And Run go run main.go
File server.go
var ServerConfig = map[string]interface{}{
"Port" : 8080,
}
Run
go run main.go
- app
- controllers // Controllers For Business logic
- middleware // MiddleWare Before Controller And Response
- libs // Customer Functions
- models // Data Model
- services // Service
- bootstrap
- application.go // Framework Bootstrap
- config
- app.go // Config Application
- database.go // Config Database And Redis
- server.go // Config Server
- routes // You Can Config Your Api Routers
api.go
- system // Framework Files
- verndor // Packages Installed By Go Mod
Add Your Route In route/api.go
route := new(Route.Route)
//Config Static Route
indexController := new(controllers.IndexController)
route.Get("/test", indexController.List)
route.Post("/test", indexController.Create)
route.Put("/test", indexController.Update)
route.Delete("/test", indexController.Delete)
Create IndexController.go In app/controllers
package controllers
import (
"github.com/valyala/fasthttp"
"github.com/wk331100/iFTY/system/http/response"
)
type IndexController struct {}
func (index *IndexController) List(ctx *fasthttp.RequestCtx){
response.Json("Hello World", ctx)
}
response structure
{
"Code": 200,
"Data": "Hello World",
"Msg": "Success"
}
``