muldap/cmd/web/init.go

34 lines
639 B
Go
Raw Permalink Normal View History

2023-03-29 18:07:46 -04:00
package web
import (
"fmt"
"github.com/flamego/flamego"
"github.com/flamego/template"
"github.com/spf13/cobra"
w "git.metaunix.net/metaunix.net/muldap/lib/web"
)
// define web command
var WebCmd = &cobra.Command{
Use: "web",
Short: "Start the web service.",
Long: `Start the Muldap web service.`,
Run: func(cmd *cobra.Command, args []string) {
fmt.Println("Starting the Muldap web server...")
// instantiate Flamego server instance
f := flamego.Classic()
// enable templates
f.Use(template.Templater())
// register routes
w.RegisterRoutes(f)
// start Flamego
f.Run()
},
}