Backends

Backends

Edit on GitHub

Primate supports writing backend logic (route files) in other programming languages than JavaScript. Non-JavaScript/TypeScript routes will be compiled to Wasm and run as WebAssembly.

As a general rule, Primate endeavors to offer the same or a similar API in other programming languages as concerns the request object that is passed to the route and the available handlers (view, redirect).

Supported backends

Support matrix

Feature JS, TS GO Python Ruby
serving strings
serving objects
serving streams
redirect handler
view handler
error handler
request.body
request.path
request.query
request.cookies
request.headers
request.session
request.store.*

Type conversions

Whenever you define and use runtime types, the request object will be augmented with dispatchers to coerce the input string into a given type. In the following is a table with the supported base types and what types they are converted to in every supported language.

Type JS GO Ruby
boolean boolean bool
i8 number int8 Integer
i16 number int16 Integer
i32 number int32 Integer
i64 bigint int64 Integer
f32 number float32 Float
f64 number float64 Float
u8 number uint8 Integer
u16 number uint16 Integer
u32 number uint32 Integer
u64 bigint uint64 Integer
string string string String
Previous
Drivers
Next
Go