gleamrpc/http/server
Types
Custom errors generated by this server
pub type HttpServerError {
MethodUnsupported(method: http.Method)
NoNameError
WrongPrefix(path: String)
}
Constructors
-
MethodUnsupported(method: http.Method)
-
NoNameError
-
WrongPrefix(path: String)
Functions
pub fn http_server() -> ProcedureServer(
Request(Connection),
Response(ResponseData),
HttpServerError,
)
Return a GleamRPC server implementation that uses HTTP requests.
To be used with gleamrpc.with_server
pub fn init_mist(
server: ProcedureServerInstance(
Request(Connection),
Response(ResponseData),
a,
HttpServerError,
),
port: Int,
) -> Builder(Connection, ResponseData)
Using a ProcedureServerInstance, serve GleamRPC requests over HTTP with Mist
Example:
gleamrpc.with_server(http_server())
|> gleamrpc.with_context(create_context)
|> gleamrpc.with_implementation(create_user_procedure, create_user)
|> gleamrpc.with_implementation(get_user_procedure, get_user)
|> init_mist(8080)
|> mist.start_http()