pub mod adapters;
pub mod batch;
pub mod crawl;
pub mod extract;
pub mod formats;
pub mod map;
pub mod scrape;
pub mod search;
use axum::Router;
use axum::routing::{get, post};
use crate::routes::method_not_allowed;
use crate::state::AppState;
pub fn router() -> Router<AppState> {
Router::new()
.route(
"/v2/scrape",
post(scrape::scrape).fallback(method_not_allowed),
)
.route(
"/v2/scrape/{job_id}",
get(scrape::get_scrape_job).fallback(method_not_allowed),
)
.route(
"/v2/crawl",
post(crawl::start_crawl).fallback(method_not_allowed),
)
.route(
"/v2/crawl/active",
get(crawl::active).fallback(method_not_allowed),
)
.route(
"/v2/crawl/{id}",
get(crawl::get_crawl)
.delete(crawl::cancel_crawl)
.fallback(method_not_allowed),
)
.route(
"/v2/crawl/{id}/errors",
get(crawl::get_errors).fallback(method_not_allowed),
)
.route("/v2/map", post(map::map).fallback(method_not_allowed))
.route(
"/v2/search",
post(search::search).fallback(method_not_allowed),
)
.route(
"/v2/batch/scrape",
post(batch::start_batch).fallback(method_not_allowed),
)
.route(
"/v2/batch/scrape/{id}",
get(batch::get_batch)
.delete(batch::cancel_batch)
.fallback(method_not_allowed),
)
.route(
"/v2/batch/scrape/{id}/errors",
get(batch::get_errors).fallback(method_not_allowed),
)
.route(
"/v2/extract",
post(extract::start_extract).fallback(method_not_allowed),
)
.route(
"/v2/extract/{id}",
get(extract::get_extract).fallback(method_not_allowed),
)
}