aboutsummaryrefslogtreecommitdiffstats
path: root/book/src/integrations.md
blob: 3d6d5086bed9fcd041b50b5db301b31a4aabf38d (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
# Integrations

## Rocket integration

Enabling the `with-rocket` feature appends an implementation of Rocket's
`Responder` trait for each template type. This makes it easy to trivially
return a value of that type in a Rocket handler. See
[the example](https://github.com/djc/askama/blob/main/askama_rocket/tests/basic.rs)
from the Askama test suite for more on how to integrate.

In case a run-time error occurs during templating, a `500 Internal Server
Error` `Status` value will be returned, so that this can be further
handled by your error catcher.

## Actix-web integration

Enabling the `with-actix-web` feature appends an implementation of Actix-web's
`Responder` trait for each template type. This makes it easy to trivially return
a value of that type in an Actix-web handler. See
[the example](https://github.com/djc/askama/blob/main/askama_actix/tests/basic.rs)
from the Askama test suite for more on how to integrate.

## Axum integration

Enabling the `with-axum` feature appends an implementation of Axum's
`IntoResponse` trait for each template type. This makes it easy to trivially
return a value of that type in a Axum handler. See
[the example](https://github.com/djc/askama/blob/main/askama_axum/tests/basic.rs)
from the Askama test suite for more on how to integrate.

In case of a run-time error occurring during templating, the response will be of the same
signature, with a status code of `500 Internal Server Error`, mime `*/*`, and an empty `Body`.
This preserves the response chain if any custom error handling needs to occur.

## Gotham integration

Enabling the `with-gotham` feature appends an implementation of Gotham's
`IntoResponse` trait for each template type. This makes it easy to trivially
return a value of that type in a Gotham handler. See
[the example](https://github.com/djc/askama/blob/main/askama_gotham/tests/basic.rs)
from the Askama test suite for more on how to integrate.

In case of a run-time error occurring during templating, the response will be of the same
signature, with a status code of `500 Internal Server Error`, mime `*/*`, and an empty `Body`.
This preserves the response chain if any custom error handling needs to occur.

## Poem integration

Enabling the `with-poem` feature appends an implementation of Poem's
`IntoResponse` trait for each template type. This makes it easy to trivially
return a value of that type in a Poem handler. See
[the example](https://github.com/djc/askama/blob/main/askama_poem/tests/basic.rs)
from the Askama test suite for more on how to integrate.

In case of a run-time error occurring during templating, the response will be of the same
signature, with a status code of `500 Internal Server Error`, mime `*/*`, and an empty `Body`.
This preserves the response chain if any custom error handling needs to occur.

## Warp integration

Enabling the `with-warp` feature appends an implementation of Warp's `Reply`
trait for each template type. This makes it simple to return a template from
a Warp filter. See [the example](https://github.com/djc/askama/blob/main/askama_warp/tests/warp.rs)
from the Askama test suite for more on how to integrate.

## Tide integration

Enabling the `with-tide` feature appends `Into<tide::Response>` and
`TryInto<tide::Body>` implementations for each template type. This
provides the ability for tide apps to build a response directly from
a template, or to append a templated body to an existing
`Response`. See [the example](https://github.com/djc/askama/blob/main/askama_tide/tests/tide.rs)
from the Askama test suite for more on how to integrate.