crw-server 0.13.3

Firecrawl-compatible API server for the CRW web scraper
Documentation
use axum::Router;
use axum::routing::{get, post};

use crate::routes::{self, method_not_allowed};
use crate::state::AppState;

/// All `/v1/*` routes. Lifted verbatim out of `app.rs` so the v1 surface stays
/// byte-identical to its pre-#62 wiring — only the location changed. Returns a
/// `Router<AppState>` (state not yet applied) so `app.rs` can `.merge()` it with
/// the v2 router and apply auth + rate-limit + state once to the whole.
pub fn router() -> Router<AppState> {
    Router::new()
        .route(
            "/v1/scrape",
            post(routes::scrape::scrape).fallback(method_not_allowed),
        )
        .route(
            "/v1/crawl",
            post(routes::crawl::start_crawl).fallback(method_not_allowed),
        )
        .route(
            "/v1/crawl/{id}",
            get(routes::crawl::get_crawl)
                .delete(routes::crawl::cancel_crawl)
                .fallback(method_not_allowed),
        )
        .route(
            "/v1/map",
            post(routes::map::map).fallback(method_not_allowed),
        )
        .route(
            "/v1/search",
            post(routes::search::search).fallback(method_not_allowed),
        )
        .route(
            "/v1/capabilities",
            get(routes::capabilities::capabilities).fallback(method_not_allowed),
        )
        .route(
            "/v1/change-tracking/diff",
            post(routes::change_tracking::diff).fallback(method_not_allowed),
        )
}