Expand description
Base support for wasm service using Confluence Workers
Structs§
- Body
- The body of a
Response
. - Context
- Context manages the information flow for an incoming HTTP [
Request
], the application handler, and the generated HTTPResponse
. It holds a buffer for log messages, and a hook for deferred tasks to be processed after theResponse
is returned. - Handler
Return - Generic page error return - doesn’t require ctx
- Http
Date - Time in UTC, with conversions to/from u64 and rfc2822
- Request
- Incoming HTTP request (to Worker).
- Response
- Worker response for HTTP requests.
The Response is created/accessed from
ctx.response()
and has a builder-like api. - RunContext
- Logging support for deferred tasks
- Service
Config - Configuration parameters for service Parameter E is your crate’s error type
- Url
- re-export url::Url A parsed URL record.
Enums§
- Error
- Errors generated by this crate It’s not necessary for users of wasm_service to import this, because Error implements trait std::error::Error.
- Method
- HTTP Method
Traits§
- Handler
- Trait that defines app/service’s request handler and router See rustwasm-service-template for a more complete example
- Runnable
- Runnable trait for deferred tasks Deferred tasks are often useful for logging and analytics.
Functions§
- default_
not_ found_ handler - Default implementation of not-found handler. Sets status to 404 and returns a short message “Not Found”
- handler_
return - Generate handler return “error”
- media_
type - Determines the Media Type (aka MIME) for file based on extension. If type is not known (based on implemented list), returns None.
- service_
request - Entrypoint for wasm-service. Converts parameters from javascript into Request,
invokes app-specific Handler, and converts
Response
to javascript. Also sends logs to Logger and runs deferred tasks.