# README
cin
The http and websocket server's framework.
Inspiration come form yii2.
Getting started
Edit file: main.go
package main
import (
"github.com/cinling/cin"
"github.com/cinling/cin/base"
)
func main() {
config := cin.NewConfig()
config.ComponentDict = map[string]base.ConfigComponentInterface{
"ws": cin.NewConfigWebsocketServer(24600),
"http": cin.NewConfigHttpServer(24601).SetSessionName("test"),
"db": cin.NewConfigDatabase("mysql", "127.0.0.1", "3306", "cin", "root", "root"),
"console": cin.NewConfigConsole(),
}
cin.App.AddConfig(config)
cin.App.Run()
}
Run go module to download dependency.
go mod tidy
Compiled code.
go build main.go
Run bin file
- on windows
./main.exe
- on linux
./main
Migrations
After Compiled code, run the following command to create migration's file.
# Packages
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
# Functions
新建配置.
新建 控制台配置.
新建 数据库配置.
新建 http server 配置.
新建 websocket server 配置.
# Constants
应用状态:初始化.
应用状态:开始(启动中).
应用状态:即将停止.
No description provided by the author
控制器类型:http.
控制器类型:websocket.
websocket server 运行模式:自动处理【推荐】 使用框架内规定的 Handler 或 BaseController 自动匹配对应的方法。发送数据必须是规范的数据。 使用该模式依然可以使用 OnMessage 接收数据。但是不能发送数据.
websocket server 运行模式:自定义处理。 自定义 OnMessage 回调方法发送数据。根据实际需求自定义数据返回.
# Variables
应用全局实例(只需要一个实例即可操作整个应用).