feat: new release of version 4
All checks were successful
Build / Checks (push) Successful in 34s
Build / Code Coverage (push) Successful in 45s
Build / Build (push) Successful in 33s

This commit is contained in:
Martin Riedl 2025-02-28 15:46:06 +01:00
parent 18a84b9b92
commit 7b5e1d0254
Signed by: martinr92
GPG key ID: FB68DA65516A804C
2 changed files with 5 additions and 5 deletions

View file

@ -13,7 +13,7 @@ httprouter is a framework used for HTTP request routing.
Just replace the standard router of golang with this one: Just replace the standard router of golang with this one:
```golang ```golang
import "git.martin-riedl.de/golang/httprouter/v3" import "git.martin-riedl.de/golang/httprouter/v4"
``` ```
```golang ```golang
router := httprouter.New() router := httprouter.New()
@ -27,7 +27,7 @@ err := http.ListenAndServe("localhost:8080", router)
A path can also contain placeholder (like :id). If then a request is sent to the url "/user/123" the method gets executed and the URL part (in this case "123") is passed as parameter into your handler function. A path can also contain placeholder (like :id). If then a request is sent to the url "/user/123" the method gets executed and the URL part (in this case "123") is passed as parameter into your handler function.
```golang ```golang
import "git.martin-riedl.de/golang/httprouter/v3" import "git.martin-riedl.de/golang/httprouter/v4"
``` ```
```golang ```golang
router := httprouter.New() router := httprouter.New()
@ -44,7 +44,7 @@ err := http.ListenAndServe("localhost:8080", router)
Static files (like JavaScript or CSS) can be served automatically (including caching header and MIME type). It uses the `embed.FS` (since go 1.16) to serve static content. Static files (like JavaScript or CSS) can be served automatically (including caching header and MIME type). It uses the `embed.FS` (since go 1.16) to serve static content.
```golang ```golang
import "git.martin-riedl.de/golang/httprouter/v3" import "git.martin-riedl.de/golang/httprouter/v4"
//go:embed files/static/* //go:embed files/static/*
var staticFiles embed.FS var staticFiles embed.FS
@ -60,7 +60,7 @@ The framework checks first, if the file exists locally and serves it directly.
If not, the file is served from the `embed.FS`. If not, the file is served from the `embed.FS`.
This helps you during local development so you can modify a CSS file without recompiling everything. This helps you during local development so you can modify a CSS file without recompiling everything.
```golang ```golang
import "git.martin-riedl.de/golang/httprouter/v3" import "git.martin-riedl.de/golang/httprouter/v4"
``` ```
```golang ```golang
staticFS := httprouter.NewFS(&staticFiles) staticFS := httprouter.NewFS(&staticFiles)

2
go.mod
View file

@ -1,3 +1,3 @@
module git.martin-riedl.de/golang/httprouter/v3 module git.martin-riedl.de/golang/httprouter/v4
go 1.19 go 1.19