真实的国产乱ⅩXXX66竹夫人,五月香六月婷婷激情综合,亚洲日本VA一区二区三区,亚洲精品一区二区三区麻豆

成都創(chuàng)新互聯(lián)網(wǎng)站制作重慶分公司

如何安裝和運(yùn)行GoAdminGroup/go-admin-創(chuàng)新互聯(lián)

今天就跟大家聊聊有關(guān)如何安裝和運(yùn)行GoAdminGroup/go-admin,可能很多人都不太了解,為了讓大家更加了解,小編給大家總結(jié)了以下內(nèi)容,希望大家根據(jù)這篇文章可以有所收獲。

創(chuàng)新互聯(lián)專(zhuān)注于新野企業(yè)網(wǎng)站建設(shè),響應(yīng)式網(wǎng)站開(kāi)發(fā),成都做商城網(wǎng)站。新野網(wǎng)站建設(shè)公司,為新野等地區(qū)提供建站服務(wù)。全流程按需求定制網(wǎng)站,專(zhuān)業(yè)設(shè)計(jì),全程項(xiàng)目跟蹤,創(chuàng)新互聯(lián)專(zhuān)業(yè)和態(tài)度為您提供的服務(wù)

使用這個(gè)GoAdminGroup/go-admin框架的最簡(jiǎn)單的例子就可以把項(xiàng)目運(yùn)行起來(lái) , go-admin 是以擴(kuò)展庫(kù)的形式使用的.

建一個(gè)main.go

package main

import (
  "io/ioutil"
  "log"
  "os"
  "os/signal"

  _ "github.com/GoAdminGroup/go-admin/adapter/gin"
  _ "github.com/GoAdminGroup/go-admin/modules/db/drivers/mysql"
  _ "github.com/GoAdminGroup/themes/sword"

  "github.com/GoAdminGroup/go-admin/engine"
  "github.com/GoAdminGroup/go-admin/examples/datamodel"
  "github.com/GoAdminGroup/go-admin/modules/config"
  "github.com/GoAdminGroup/go-admin/modules/language"
  "github.com/GoAdminGroup/go-admin/plugins/example"
  "github.com/GoAdminGroup/go-admin/template"
  "github.com/GoAdminGroup/go-admin/template/chartjs"
  "github.com/GoAdminGroup/themes/adminlte"
  "github.com/gin-gonic/gin"
)

func main() {
  gin.SetMode(gin.ReleaseMode)
  gin.DefaultWriter = ioutil.Discard

  r := gin.New()

  e := engine.Default()

  cfg := config.Config{
    Env: config.EnvLocal,
    Databases: config.DatabaseList{
      "default": {
        Host:    "127.0.0.1",
        Port:    "3306",
        User:    "goadmin",
        Pwd:    "goadmin",
        Name:    "goadmin",
        MaxIdleCon: 50,
        MaxOpenCon: 150,
        Driver:   config.DriverMysql,

        //Driver: config.DriverSqlite,
        //File:  "../datamodel/admin.db",
      },
    },
    UrlPrefix: "admin",
    Store: config.Store{
      Path:  "./uploads",
      Prefix: "uploads",
    },
    Language:      language.CN,
    IndexUrl:      "/",
    Debug:       true,
    AccessAssetsLogOff: true,
    Animation: config.PageAnimation{
      Type: "fadeInUp",
    },
    ColorScheme:    adminlte.ColorschemeSkinBlack,
    BootstrapFilePath: "./../datamodel/bootstrap.go",
  }

  template.AddComp(chartjs.NewChart())

  // customize a plugin

  examplePlugin := example.NewExample()

  // load from golang.Plugin
  //
  // examplePlugin := plugins.LoadFromPlugin("../datamodel/example.so")

  // customize the login page
  // example: /tupian/20230522/main.go
  //
  // template.AddComp("login", datamodel.LoginPage)

  // load config from json file
  //
  // e.AddConfigFromJSON("../datamodel/config.json")

  if err := e.AddConfig(cfg).
    AddGenerators(datamodel.Generators).
    // add generator, first parameter is the url prefix of table when visit.
    // example:
    //
    // "user" => http://localhost:9033/admin/info/user
    //
    AddGenerator("user", datamodel.GetUserTable).
    AddDisplayFilterXssJsFilter().
    AddPlugins(examplePlugin).
    Use(r); err != nil {
    panic(err)
  }

  r.Static("/uploads", "./uploads")

  // customize your pages

  e.HTML("GET", "/admin", datamodel.GetContent)

  go func() {
    _ = r.Run(":9033")
  }()

  quit := make(chan os.Signal, 1)
  signal.Notify(quit, os.Interrupt)
  <-quit
  log.Print("closing database connection")
  e.MysqlConnection().Close()
}

新聞名稱(chēng):如何安裝和運(yùn)行GoAdminGroup/go-admin-創(chuàng)新互聯(lián)
瀏覽地址:http://weahome.cn/article/dheddo.html

其他資訊

在線(xiàn)咨詢(xún)

微信咨詢(xún)

電話(huà)咨詢(xún)

028-86922220(工作日)

18980820575(7×24)

提交需求

返回頂部