Quick Start
main.go
package main
import (
_ "github.com/GoAdminGroup/go-admin/adapter/gin" // Import the adapter, it must be imported. If it is not imported, you need to define it yourself.
_ "github.com/GoAdminGroup/themes/adminlte" // Import the theme
_ "github.com/GoAdminGroup/go-admin/modules/db/drivers/mysql" // Import the sql driver
"github.com/GoAdminGroup/go-admin/engine"
"github.com/GoAdminGroup/go-admin/modules/config"
"github.com/GoAdminGroup/go-admin/modules/language"
"github.com/gin-gonic/gin"
)
func main() {
r := gin.Default()
// Instantiate a GoAdmin engine object.
eng := engine.Default()
// GoAdmin global configuration, can also be imported as a json file.
cfg := config.Config{
Databases: []config.Database{
{
Host: "127.0.0.1",
Port: "3306",
User: "root",
Pwd: "root",
Name: "godmin",
MaxIdleCon: 50,
MaxOpenCon: 150,
Driver: "mysql",
},
},
UrlPrefix: "admin", // The url prefix of the website.
// Store must be set and guaranteed to have write access, otherwise new administrator users cannot be added.
Store: config.Store{
Path: "./uploads",
Prefix: "uploads",
},
Language: language.EN,
}
// Add configuration and plugins, use the Use method to mount to the web framework.
_ = eng.AddConfig(cfg).
Use(r)
_ = r.Run(":9033")
}Add your own business table for management
How To Use PluginsHow To Use Admin PluginGlobal configuration item description
Last updated