Pudu programming language
Menu

Std.Http.Server.Lambda.serve

1 declaration

fn

serve: &Std.Http.Server.Lambda.Runtime -> fn(Std.Json.Json) -> Result[Str, Str] -> Result[(), Std.Http.Server.Lambda.LambdaError]

This is a callable function.

What it does

Take invocations and answer them until the platform stops the process.

The handler is given the event and answers the body to post back. It is the

caller's, so what a function does with an event — decode it as a request,

read a field, ignore it — stays in the program rather than here.

A handler that fails is reported against the invocation it failed on and the

loop continues. One request that cannot be answered is not a reason to stop

answering the next, and a process that ended on one bad request would be

started again to meet the same one.

Read the signature

  • The text after the name is the type checked by Pudu.
  • Read arrows from left to right: inputs come first, and the final type is returned.
  • & borrows a value for this call instead of moving or copying it.
  • Names inside [ ] are type arguments, such as the item type held by a collection.
  • Result makes success and recoverable failure part of the function's type.

Back to Std.Http.Server.LambdaSearch related declarations