gowebbuild/serve.go

23 lines
376 B
Go
Raw Normal View History

2023-09-13 11:45:24 +02:00
package main
import (
"fmt"
"github.com/kataras/iris/v12"
)
func Serve(root string, port uint) error {
app := iris.New()
app.HandleDir("/", iris.Dir(root), iris.DirOptions{
IndexName: "/index.html",
Compress: false,
ShowList: true,
ShowHidden: true,
Cache: iris.DirCacheOptions{
Enable: false,
},
})
return app.Listen(fmt.Sprintf(":%d", port))
}