Updated documentation

This commit is contained in:
2024-03-07 18:09:51 +01:00
parent dde1b64e32
commit 525cf89539
6 changed files with 38 additions and 35 deletions

View File

@ -2,15 +2,17 @@
HTTP server.
## Features
- Specificity based routing
## Installation
```shell
go get git.akyoto.dev/go/server
```
## Examples
Init:
## Usage
```go
s := server.New()
@ -20,7 +22,7 @@ s := server.New()
http.ListenAndServe(":8080", s)
```
Static:
### Static
```go
s.Get("/", func(ctx server.Context) error {
@ -28,7 +30,7 @@ s.Get("/", func(ctx server.Context) error {
})
```
Parameter:
### Parameter
```go
s.Get("/blog/:post", func(ctx server.Context) error {
@ -36,10 +38,31 @@ s.Get("/blog/:post", func(ctx server.Context) error {
})
```
Wildcard:
### Wildcard
```go
s.Get("/images/*file", func(ctx server.Context) error {
return ctx.String(ctx.Get("file"))
})
```
```
## Tests
```
PASS: TestRouter
PASS: TestPanic
coverage: 100.0% of statements
```
## Benchmarks
```
```
## License
Please see the [license documentation](https://akyoto.dev/license).
## Copyright
© 2023 Eduard Urbach