Added more security and metrics
This commit is contained in:
@@ -1,8 +1,8 @@
|
||||
# EonaCat.DoxaApi
|
||||
|
||||
**A modern, self-contained, dependency-free API documentation UI for ASP.NET Core**
|
||||
**A modern, self-contained API documentation UI for ASP.NET Core with built-in analytics and monitoring**
|
||||
|
||||
DoxaApi reflects over your controllers, generates an OpenAPI-compatible document, and serves a fast, single-page documentation UI with zero JavaScript dependencies. No npm build step, no CDN calls, no telemetry - one NuGet package, one line in `Program.cs`.
|
||||
DoxaApi reflects over your controllers, generates an OpenAPI-compatible document, and serves a fast, single-page documentation UI.
|
||||
|
||||

|
||||
|
||||
@@ -41,10 +41,6 @@ app.Run();
|
||||
|
||||
Run the app and open `/doxa`. That's the whole setup.
|
||||
|
||||
|
||||
|
||||
## Authoring your documentation
|
||||
|
||||
DoxaApi reads standard `///` XML doc comments and a handful of optional attributes:
|
||||
|
||||
```csharp
|
||||
@@ -104,7 +100,35 @@ Credentials entered in the UI are stored in the browser's `localStorage` (never
|
||||
|
||||
|
||||
|
||||
## Mock server
|
||||
## Analytics Dashboard
|
||||
|
||||
The built-in **Analytics Dashboard** provides real-time insights into your API usage:
|
||||
|
||||
- **Endpoint Statistics** - View total requests, success rate, and average response times per endpoint
|
||||
- **Request History** - Track recent requests with status codes and response times
|
||||
- **Performance Metrics** - Monitor overall API health and uptime
|
||||
- **Top Endpoints** - Identify your most-used endpoints at a glance
|
||||
|
||||
Click the **Dashboard** button in the top navigation to view live analytics. Metrics are automatically collected and refreshed every 5 seconds.
|
||||
|
||||
```csharp
|
||||
// Access analytics programmatically
|
||||
var metricsCollector = app.ApplicationServices.GetService<MetricsCollector>();
|
||||
if (metricsCollector != null)
|
||||
{
|
||||
var dashboard = metricsCollector.GetDashboard();
|
||||
var recentRequests = metricsCollector.GetRecentRequests(limit: 50);
|
||||
}
|
||||
```
|
||||
|
||||
Get the analytics JSON via:
|
||||
```
|
||||
GET /doxa/analytics
|
||||
```
|
||||
|
||||
All API requests and responses are automatically serialized, ensuring consistent behavior across your entire API documentation.
|
||||
|
||||
## Authoring your documentation
|
||||
|
||||
Every endpoint can return a schema-shaped fake response without touching your real controllers - flip the **"Send to mock server"** toggle in the Try-it panel, or call it directly:
|
||||
|
||||
|
||||
Reference in New Issue
Block a user