Crate wasm_framework

Source
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 HTTP Response. It holds a buffer for log messages, and a hook for deferred tasks to be processed after the Response is returned.
HandlerReturn
Generic page error return - doesn’t require ctx
HttpDate
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
ServiceConfig
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.