34 lines
639 B
Go
34 lines
639 B
Go
|
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()
|
||
|
},
|
||
|
}
|