Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 15 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@ The framework is named after the okapi (/oʊˈkɑːpiː/), a rare and graceful m

✔ **Built-in Auth & Security** – Native support for **JWT, OAuth2, Basic Auth**, and custom middleware.

✔ **Standard Library Compatibility** - Integrates seamlessly with Go’s net/http standard library.

✔ **Blazing Fast Routing** – Optimized HTTP router with low overhead for high-performance applications.

✔ **First-Class Documentation** – **OpenAPI 3.0 & Swagger UI** integrated out of the box—auto-generate API docs with minimal effort.
Expand Down Expand Up @@ -334,7 +336,7 @@ Okapi supports simple, declarative validation using struct tags.
### Built-in Example (Basic Auth)

```go
auth := okapi.BasicAuthMiddleware{
auth := okapi.BasicAuth{
Username: "admin",
Password: "password",
Realm: "Restricted",
Expand Down Expand Up @@ -369,6 +371,18 @@ func customMiddleware(next okapi.HandlerFunc) okapi.HandlerFunc {
o.Use(customMiddleware)
```

### Std Middleware

```go
o.UseMiddleware(func(handler http.Handler) http.Handler {
return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
slog.Info("Hello Go standard HTTP middleware function")
handler.ServeHTTP(w, r)
})

})
```

---

### OpenAPI/Swagger Integration
Expand Down
2 changes: 1 addition & 1 deletion middlewares_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ func TestJwtMiddleware(t *testing.T) {
func TestBasicAuth(t *testing.T) {
username := "user"
password := "password"
auth := BasicAuthMiddleware{Username: username, Password: password, ContextKey: "username"}
auth := BasicAuth{Username: username, Password: password, ContextKey: "username"}

app := Default()
app.Use(auth.Middleware)
Expand Down