Updated documentation

This commit is contained in:
Eduard Urbach 2024-03-07 18:17:01 +01:00
parent 0ce58609c1
commit 070b374c6e
Signed by: akyoto
GPG Key ID: C874F672B1AF20C0

View File

@ -4,7 +4,8 @@ HTTP server.
## Features
- Specificity based routing
- Low latency
- Radix tree routing
## Installation
@ -17,33 +18,22 @@ go get git.akyoto.dev/go/server
```go
s := server.New()
// Add your routes here.
http.ListenAndServe(":8080", s)
```
### Static
```go
// Static route
s.Get("/", func(ctx server.Context) error {
return ctx.String("Hello")
})
```
### Parameter
```go
// Parameter route
s.Get("/blog/:post", func(ctx server.Context) error {
return ctx.String(ctx.Get("post"))
})
```
### Wildcard
```go
// Wildcard route
s.Get("/images/*file", func(ctx server.Context) error {
return ctx.String(ctx.Get("file"))
})
http.ListenAndServe(":8080", s)
```
## Tests
@ -57,6 +47,7 @@ coverage: 100.0% of statements
## Benchmarks
```
coming soon
```
## License