github.com/volts-dev/volts@v0.0.0-20240120094013-5e9c65924106/demo/web/volts_module/main.go (about)

     1  package main
     2  
     3  import (
     4  	"github.com/volts-dev/volts"
     5  	"github.com/volts-dev/volts/demo/web/volts_module/group/base"
     6  	"github.com/volts-dev/volts/demo/web/volts_module/group/web"
     7  	"github.com/volts-dev/volts/router"
     8  	"github.com/volts-dev/volts/server"
     9  )
    10  
    11  func main() {
    12  	r := router.New()
    13  	r.RegisterGroup(base.Base)
    14  	r.RegisterGroup(web.Web)
    15  
    16  	r.SetTemplateVar("VOLTS", "Hi Guy")
    17  	srv := server.New(
    18  		server.WithRouter(r),
    19  	)
    20  
    21  	// serve as a http server
    22  	app := volts.New(
    23  		volts.Server(srv),
    24  		volts.Debug(),
    25  	)
    26  	app.Run()
    27  }