scorpion.controller

Undocumented in source.

Members

Enums

Body
enum Body

Attribute that indicates that the parameter is converted from the request's body. The parameter must be either a struct or a class that will be insantiated by the validator and validated by it. The method is not usually called when the validation fails, but if the method also contains a scorpion.validation.Validation object as paramter the method is called even when the object was not successfully validated. To learn more about the validation process and the attributes that can be added to the object's members to validate see the scorpion.validation module's documentation.

Path
enum Path

Attribute that indicates that the paramater is from a path's regex capture. The number of parameters annotated with @Path should correspond to the number of captures in the path. The type of the parameter can be any type that can be converted from a string: it's the programmer's duty to write a regular expression that won't cause any conversion exception.

Paths
enum Paths

Useful regular expressions for routing. Note that every regular expression in this enum is enclosed in a capturing group.

Functions

Delete
Route Delete(string[] path)
Get
Route Get(string[] path)
Patch
Route Patch(string[] path)
Post
Route Post(string[] path)
Put
Route Put(string[] path)

Attributes for routes. Indicates the method used (case sensitive, usually uppercase), whether the method can have a body and the path.

Structs

Async
struct Async

Attribute that marks a function as asynchronous. It means that the response is not sent to the client when the method returns but when the send function is called in the response. This attribute should be used when the route's method permorms an asynchrous action such as a client http call or using the database.

Callable
struct Callable

Callable functions are routes that can be called from javascipt using scorpion's javscript file (served to /assets/scorpion.js), calling the scorpion.call javscript function. The javascipt function takes a arguments the name of the function, an object with the function's parameter and a callback. Both the object and the callbacks are optional.

Controller
struct Controller

Attribute for controllers to be used with classes that contain routes.

Param
struct Param

Attribute that indicates that the parameter is from a path's query. The parameter's type can be any type that can be converted from a string. If the conversion fails a bad request client error is returned to the client and the handler is not called.

Route
struct Route

Attributes for routes. Indicates the method used (case sensitive, usually uppercase), whether the method can have a body and the path.

Meta