Skip to main content

apigate_core/
lib.rs

1mod app;
2mod backend;
3mod balancing;
4mod error;
5mod hook;
6mod map;
7mod parts_ctx;
8mod policy;
9mod proxy;
10mod route;
11mod routing;
12
13pub use app::{App, AppBuilder, run};
14pub use error::ApigateError;
15pub use hook::{BeforeFn, BeforeFuture, HookResult};
16pub use map::{MapFn, MapFuture, MapRequestResult, MapResult};
17pub use parts_ctx::PartsCtx;
18pub use route::{DstChunk, RewriteSpec, RewriteTemplate, SrcSeg};
19
20#[derive(Clone, Copy, Debug)]
21pub enum Method {
22    Get,
23    Post,
24    Put,
25    Delete,
26    Patch,
27    Head,
28    Options,
29}
30
31#[derive(Clone, Copy, Debug)]
32pub struct RouteDef {
33    pub method: Method,
34    pub path: &'static str,
35    pub rewrite: RewriteSpec,
36    pub policy: Option<&'static str>,
37    pub before: Option<BeforeFn>,
38    pub map: Option<MapFn>,
39}
40
41#[derive(Clone, Copy, Debug)]
42pub struct Routes {
43    pub service: &'static str,
44    pub prefix: &'static str,
45    pub policy: Option<&'static str>,
46    pub routes: &'static [RouteDef],
47}