Actions
Actions are the core building blocks of Nile. Each action represents a single operation that can be called via the REST-RPC interface.
createAction
Options
Handler Signature
The handler receives input data and context, and must return a Result<T, E> from slang-ts:
Use Ok(data) for success and Err(error) for failures:
Example: Action with Validation
Multiple Actions
Actions are typically defined in separate files and then grouped into a service:
Then group them in the service config:
Accessing Context
The handler receives a second parameter with access to resources: