Skip to main content

Crate parse_rust_server

Crate parse_rust_server 

Source
Expand description

Parse Server as a library: router, middleware, config.

A library first, with a thin binary on top. Native Rust triggers require the deployment to compile its own binary, and adapters are registered through a builder rather than resolved from a module name, so the primary artifact is something you link against. parse-rust-cli is a separate package rather than a feature of this one: feature unification means a sibling crate enabling a cli feature would pull its dependencies back in even for an embedder that set default-features = false, and a separate package cannot be re-enabled by anyone else’s feature choice.

Scope today: /health and /serverInfo; signup, login, /users/me and logout; the five /classes verbs and the five /roles verbs; the five /schemas verbs and DELETE /purge/:className, all master-key only; four /sessions reads; and POST /batch. Everything else answers 404.

Two things are resolved once per HTTP request and shared by every operation in it: the schema snapshot and the caller’s expanded role list. See request. A /batch of twenty writes therefore expands roles once and cannot see two different schemas mid-flight, which is a correctness property rather than a performance one.

An embedder that builds the router itself must call AppState::ensure_indexes first. serve does it for you. Mounting router into your own axum app does not, and without those indexes duplicate usernames are accepted silently, which is a data problem rather than an error anyone sees.

Re-exports§

pub use auth::Authority;
pub use auth::Credentials;
pub use auth::HeaderRejection;
pub use config::ProtectedFieldsConfig;
pub use config::ServerConfig;
pub use request::RequestContext;
pub use state::AppState;

Modules§

auth
Request identity, derived from headers.
body_credentials
Normalizing what the JavaScript SDK actually sends.
config
Server configuration.
cors
allowCrossDomain: the CORS headers every response carries, and the preflight answer.
params
Query parameters, from wherever they arrived.
request
Everything one HTTP request resolves once and then shares.
response
Error response envelopes.
routes
HTTP routes. One module per upstream router, so a change upstream maps to an obvious place.
state
Server state: config plus the storage adapter.

Functions§

router
Build the router.
serve
Bind and serve. Returns the bound address, which matters when the caller asked for port 0.