Updated documentation
This commit is contained in:
parent
0ce58609c1
commit
070b374c6e
25
README.md
25
README.md
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user