Crate sentrystr_api

Crate sentrystr_api 

Source
Expand description

§SentryStr API

REST API server for SentryStr event collection and querying.

§Quick Start

use sentrystr_api::create_app;

#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
    let _app = create_app();
    println!("SentryStr API server would run on http://localhost:3000");
    Ok(())
}

§API Endpoints

§GET /events

Query events with optional filters:

curl "http://localhost:3000/events?limit=10&level=error"
curl "http://localhost:3000/events?author=npub1...&since=2024-01-01T00:00:00Z"

§GET /events/{author}

Get events by specific author:

curl "http://localhost:3000/events/npub1abc123.../events"

§GET /health

Health check endpoint:

curl "http://localhost:3000/health"

§With Tracing Integration

use sentrystr_api::create_app;

#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
    let _app = create_app();
    println!("Starting SentryStr API server");
    Ok(())
}

Re-exports§

pub use api::create_app;
pub use handlers::*;
pub use models::*;

Modules§

api
handlers
models

Enums§

ApiError

Type Aliases§

Result