blob: a1e331865386fed8c7596878902a642b4e241a45 (
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
74
75
|
# Windmark Comments
[](https://crates.io/crates/windmark-comments)
[](https://docs.rs/windmark-comments)
[](https://github.com/gemrest/windmark-comments/actions/workflows/check.yaml)
A comment engine module for Windmark.
## Usage
### Add Windmark Comments as a dependency
```toml
# Cargo.toml
[dependencies]
windmark-comments = "0.1.3"
```
### Attach Windmark Comments as a module (Windmark >= 0.1.8)
```rust
// src/main.rs
use windmark::Response;
#[windmark::main]
fn main() -> Result<(), Box<dyn std::error::Error>> {
windmark::Router::new()
.set_private_key_file("windmark_comments_private.pem")
.set_certificate_file("windmark_comments_public.pem")
.mount("/", Box::new(|_| Response::Success("Hello, World!".into())))
.set_error_handler(Box::new(|_| {
Response::PermanentFailure("This route does not exist!".into())
}))
// Attach Windmark Comments
.attach_stateless(windmark_comments::module)
.run()
.await
}
```
### Attach Windmark Comments as a module (Windmark <= 0.1.7)
```rust
// src/main.rs
use windmark::Response;
#[windmark::main]
fn main() -> Result<(), Box<dyn std::error::Error>> {
windmark::Router::new()
.set_private_key_file("windmark_comments_private.pem")
.set_certificate_file("windmark_comments_public.pem")
.mount("/", Box::new(|_| Response::Success("Hello, World!".into())))
.set_error_handler(Box::new(|_| {
Response::PermanentFailure("This route does not exist!".into())
}))
// Attach Windmark Comments
.attach(windmark_comments::module)
.run()
.await
}
```
## Examples
Examples can be found within the
[`examples`](https://github.com/gemrest/windmark-comments/tree/main/examples)
directory.
## License
This project is licensed with the
[GNU General Public License v3.0](https://github.com/gemrest/windmark-comments/blob/main/LICENSE).
|