25 lines
287 B
Go
Raw Normal View History

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