diff --git a/.editorconfig b/.editorconfig deleted file mode 100644 index 2b4f594..0000000 --- a/.editorconfig +++ /dev/null @@ -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 \ No newline at end of file diff --git a/.gitignore b/.gitignore index f4f3836..7dbfd92 100644 --- a/.gitignore +++ b/.gitignore @@ -1,9 +1,7 @@ * !*/ +!.gitignore !*.go -!go.mod -!go.sum -!LICENSE -!README.md -!.editorconfig -!.gitignore \ No newline at end of file +!*.md +!*.mod +!*.sum diff --git a/LICENSE b/LICENSE deleted file mode 100644 index 40d5bcd..0000000 --- a/LICENSE +++ /dev/null @@ -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. diff --git a/README.md b/README.md index ee12c2f..050842f 100644 --- a/README.md +++ b/README.md @@ -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")) }) -``` \ No newline at end of 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 diff --git a/go.mod b/go.mod index c493264..1b5293b 100644 --- a/go.mod +++ b/go.mod @@ -1,8 +1,8 @@ module git.akyoto.dev/go/server -go 1.20 +go 1.22 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 ) diff --git a/go.sum b/go.sum index d70dccc..2b79a30 100644 --- a/go.sum +++ b/go.sum @@ -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.2/go.mod h1:Zr/UFuiqmqRmFFgpBGwF71jbzb6iYJfXFeePYHGtWsg= +git.akyoto.dev/go/assert v0.1.3 h1:QwCUbmG4aZYsNk/OuRBz1zWVKmGlDUHhOnnDBfn8Qw8= +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/go.mod h1:IwwEUJU2ExmozpZKMbDOKdiVT516oAijnxGDg9kvBt4=