mirror of
https://github.com/ZSCNetSupportDept/scheduler.git
synced 2025-10-28 20:45:05 +08:00
add 数据库 Web框架 初步 支持
This commit is contained in:
@@ -21,6 +21,7 @@ func Load() {
|
||||
File = viper.GetString("File")
|
||||
DB.Path = viper.GetString("DB.Path")
|
||||
//DB.Port = viper.GetString("DB.Port")
|
||||
DB.Type = viper.GetString("DB.Type")
|
||||
|
||||
err := check()
|
||||
if err != nil {
|
||||
@@ -42,5 +43,6 @@ func debugprint() {
|
||||
fmt.Printf("ListenPort=%v\n", ListenPort)
|
||||
fmt.Printf("File=%v\n", File)
|
||||
fmt.Printf("database path : %s\n", DB.Path)
|
||||
fmt.Printf("database type:%s\n", DB.Type)
|
||||
|
||||
}
|
||||
|
||||
12
config/middleware.go
Normal file
12
config/middleware.go
Normal file
@@ -0,0 +1,12 @@
|
||||
package config
|
||||
|
||||
import (
|
||||
"github.com/labstack/echo/v4"
|
||||
"github.com/labstack/echo/v4/middleware"
|
||||
)
|
||||
|
||||
func Middleware(app *echo.Echo) {
|
||||
//here are middlewares we use
|
||||
app.Use(middleware.Logger())
|
||||
app.Use(middleware.Recover())
|
||||
}
|
||||
@@ -13,4 +13,5 @@ type database struct {
|
||||
//Password string
|
||||
|
||||
// enable if you want use an instance other than SQLite
|
||||
Type string
|
||||
}
|
||||
|
||||
10
config/route.go
Normal file
10
config/route.go
Normal file
@@ -0,0 +1,10 @@
|
||||
package config
|
||||
|
||||
import (
|
||||
"github.com/labstack/echo/v4"
|
||||
)
|
||||
|
||||
func Route(app *echo.Echo) {
|
||||
// here is the route for our site
|
||||
app.File("/", "FrontEnd/index.html")
|
||||
}
|
||||
Reference in New Issue
Block a user