Updated documentation

This commit is contained in:
Eduard Urbach 2024-03-07 18:09:51 +01:00
parent dde1b64e32
commit 525cf89539
Signed by: akyoto
GPG Key ID: C874F672B1AF20C0
6 changed files with 38 additions and 35 deletions

View File

@ -1,9 +0,0 @@
root = true
[*]
indent_style = tab
indent_size = 4
end_of_line = lf
charset = utf-8
trim_trailing_whitespace = true
insert_final_newline = false

10
.gitignore vendored
View File

@ -1,9 +1,7 @@
* *
!*/ !*/
!*.go
!go.mod
!go.sum
!LICENSE
!README.md
!.editorconfig
!.gitignore !.gitignore
!*.go
!*.md
!*.mod
!*.sum

View File

@ -1,9 +0,0 @@
MIT License
Copyright (c) 2023 Eduard Urbach
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

View File

@ -2,15 +2,17 @@
HTTP server. HTTP server.
## Features
- Specificity based routing
## Installation ## Installation
```shell ```shell
go get git.akyoto.dev/go/server go get git.akyoto.dev/go/server
``` ```
## Examples ## Usage
Init:
```go ```go
s := server.New() s := server.New()
@ -20,7 +22,7 @@ s := server.New()
http.ListenAndServe(":8080", s) http.ListenAndServe(":8080", s)
``` ```
Static: ### Static
```go ```go
s.Get("/", func(ctx server.Context) error { s.Get("/", func(ctx server.Context) error {
@ -28,7 +30,7 @@ s.Get("/", func(ctx server.Context) error {
}) })
``` ```
Parameter: ### Parameter
```go ```go
s.Get("/blog/:post", func(ctx server.Context) error { 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 ```go
s.Get("/images/*file", func(ctx server.Context) error { s.Get("/images/*file", func(ctx server.Context) error {
return ctx.String(ctx.Get("file")) 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

4
go.mod
View File

@ -1,8 +1,8 @@
module git.akyoto.dev/go/server module git.akyoto.dev/go/server
go 1.20 go 1.22
require ( require (
git.akyoto.dev/go/assert v0.1.2 git.akyoto.dev/go/assert v0.1.3
git.akyoto.dev/go/router v0.1.1 git.akyoto.dev/go/router v0.1.1
) )

4
go.sum
View File

@ -1,4 +1,4 @@
git.akyoto.dev/go/assert v0.1.2 h1:3paz/5z/JcGK/2K9J+pVh5Jwt2gYfJQG+P5OE9/jB7Y= git.akyoto.dev/go/assert v0.1.3 h1:QwCUbmG4aZYsNk/OuRBz1zWVKmGlDUHhOnnDBfn8Qw8=
git.akyoto.dev/go/assert v0.1.2/go.mod h1:Zr/UFuiqmqRmFFgpBGwF71jbzb6iYJfXFeePYHGtWsg= git.akyoto.dev/go/assert v0.1.3/go.mod h1:0GzMaM0eURuDwtGkJJkCsI7r2aUKr+5GmWNTFPgDocM=
git.akyoto.dev/go/router v0.1.1 h1:6fHjzv59MKMhO2DsM90mkI5hy5PrcjV4WeD1Vk1xXXs= git.akyoto.dev/go/router v0.1.1 h1:6fHjzv59MKMhO2DsM90mkI5hy5PrcjV4WeD1Vk1xXXs=
git.akyoto.dev/go/router v0.1.1/go.mod h1:IwwEUJU2ExmozpZKMbDOKdiVT516oAijnxGDg9kvBt4= git.akyoto.dev/go/router v0.1.1/go.mod h1:IwwEUJU2ExmozpZKMbDOKdiVT516oAijnxGDg9kvBt4=