25 lines
287 B
Go
Raw Permalink Normal View History

2024-03-13 19:18:01 +00:00
package main
import (
"fmt"
"time"
2024-03-22 14:08:24 +00:00
"git.akyoto.dev/go/web"
2024-03-13 19:18:01 +00:00
)
func main() {
2024-03-22 14:08:24 +00:00
s := web.NewServer()
2024-03-13 19:18:01 +00:00
2024-03-22 14:08:24 +00:00
s.Use(func(ctx web.Context) error {
2024-03-13 19:18:01 +00:00
start := time.Now()
defer func() {
2024-03-16 14:22:47 +00:00
fmt.Println(ctx.Request().Path(), time.Since(start))
2024-03-13 19:18:01 +00:00
}()
return ctx.Next()
})
s.Run(":8080")
}