Examples
Check out the complete examples in the example/ directory of the MoniGo repository.
Router Integration Examples
Section titled “Router Integration Examples”example/router-integration/- Standard HTTP mux integrationexample/api-only-integration/- API-only integration
Framework Integration Examples
Section titled “Framework Integration Examples”example/gin-integration/- Gin framework integrationexample/echo-integration/- Echo framework integration
Security Examples
Section titled “Security Examples”Located in example/security-examples/:
Core Security
Section titled “Core Security”- Basic Authentication (
basic-auth/) - HTTP Basic Auth with rate limiting - API Key Authentication (
api-key/) - API key via header or query parameter - IP Whitelist (
ip-whitelist-example/) - IP-based access control with debug logging - Custom Authentication (
custom-auth/) - Custom auth function with headers / query params
Framework Security
Section titled “Framework Security”- Gin (
gin/) - Gin framework with security middleware - Echo (
echo/) - Echo framework with security middleware - Fiber (
fiber/) - Fiber framework with security middleware - Chi (
chi/) - Chi router with security middleware
Running Examples
Section titled “Running Examples”Each example has its own go.mod file and can be run independently:
# Basic examplecd example/router-integrationgo run .
# Security examplecd example/security-examples/basic-authgo run .
# Framework examplecd example/security-examples/gingo run .Example Access URLs
Section titled “Example Access URLs”| Example | URL | Credentials |
|---|---|---|
| Basic Auth | http://localhost:8080/ | admin / monigo-secure-2024 |
| API Key | http://localhost:8080/?api_key=monigo-secret-key-2024 | - |
| IP Whitelist | http://localhost:8080/ | localhost only |
| Custom Auth | http://localhost:8080/?secret=monigo-admin-secret | - |