🚀 Web server. 17 Commits
2024-03-12 20:35:19 +01:00
examples/hello Added router benchmarks 2024-03-12 20:35:19 +01:00
.gitignore Updated documentation 2024-03-07 18:09:51 +01:00
Benchmarks_test.go Added router benchmarks 2024-03-12 20:35:19 +01:00
Context.go Removed SetStatus 2023-07-22 14:14:50 +02:00
go.mod Added router benchmarks 2024-03-12 20:35:19 +01:00
go.sum Added router benchmarks 2024-03-12 20:35:19 +01:00
Handler.go Added router benchmarks 2024-03-12 20:35:19 +01:00
NullResponse_test.go Added router benchmarks 2024-03-12 20:35:19 +01:00
pool.go Renamed module 2023-07-18 21:48:38 +02:00
README.md Added router benchmarks 2024-03-12 20:35:19 +01:00
Request.go Added request and response 2023-07-22 12:32:52 +02:00
Response.go Added request and response 2023-07-22 12:32:52 +02:00
Route_test.go Added router benchmarks 2024-03-12 20:35:19 +01:00
Server_test.go Added router benchmarks 2024-03-12 20:35:19 +01:00
Server.go Added router benchmarks 2024-03-12 20:35:19 +01:00

server

HTTP server.

Features

  • Low latency
  • Radix tree routing

Installation

go get git.akyoto.dev/go/server

Usage

s := server.New()

// Static route
s.Get("/", func(ctx server.Context) error {
	return ctx.String("Hello")
})

// Parameter route
s.Get("/blog/:post", func(ctx server.Context) error {
	return ctx.String(ctx.Get("post"))
})

// Wildcard route
s.Get("/images/*file", func(ctx server.Context) error {
	return ctx.String(ctx.Get("file"))
})

http.ListenAndServe(":8080", s)

Tests

PASS: TestRouter
PASS: TestPanic
coverage: 100.0% of statements

Benchmarks

BenchmarkHello-12       33502272                33.64 ns/op            0 B/op          0 allocs/op
BenchmarkGitHub-12      17698947                65.50 ns/op            0 B/op          0 allocs/op

License

Please see the license documentation.

© 2023 Eduard Urbach