aboutsummaryrefslogtreecommitdiff
path: root/README.md
blob: a01b5972d6c130693dc675873ac480041aaa804d (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
76
77
78
79
80
81
82
83
84
# Windmark

[![crates.io](https://img.shields.io/crates/v/windmark.svg)](https://crates.io/crates/windmark)
[![docs.rs](https://docs.rs/windmark/badge.svg)](https://docs.rs/windmark)
[![github.com](https://github.com/gemrest/windmark/actions/workflows/check.yaml/badge.svg?branch=main)](https://github.com/gemrest/windmark/actions/workflows/check.yaml)

Windmark is an elegant and highly performant, async Gemini server framework for
the modern age!

## Usage

Check out an example starter project
[here](https://github.com/gemrest/windmark-starter-project)!

### Add Windmark and Tokio as Dependencies

```toml
# Cargo.toml

[dependencies]
windmark = "0.3.5"
tokio = { version = "1.26.0", features = ["full"] }

# If you would like to use the built-in logger (recommended)
# windmark = { version = "0.3.5", features = ["logger"] }

# If you would like to use the built-in MIME dedection when `Success`-ing a file
# (recommended)
# windmark = { version = "0.3.5", features = ["auto-deduce-mime"] }

# If you would like to use macro-based responses (as seen below)
# windmark = { version = "0.3.5", features = ["response-macros"] }
```

### Implement a Windmark server

```rust
// src/main.rs

use windmark::Response;

#[windmark::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
  windmark::Router::new()
    .set_private_key_file("windmark_private.pem")
    .set_certificate_file("windmark_public.pem")
    .mount("/", windmark::success!("Hello, World!"))
    .set_error_handler(
      windmark::permanent_failure!("This route does not exist!")
    )
    .run()
    .await
}
```

## Examples

Examples can be found within the
[`examples/`](https://github.com/gemrest/windmark/tree/main/examples) directory.

An example of a fully featured Gemini capsule written using Windmark can be
found [here](https://github.com/gemrest/locus). This example Gemini capsule also
happens to be the source code for [Fuwn's](https://github.com/Fuwn) (this
library's author) personal Gemini capsule!

## Modules

Modules are reusable extensions which can be procedurally mounted onto Windmark
routers.

[Add yours!](https://github.com/gemrest/windmark/edit/main/README.md)

- [Windmark Comments](https://github.com/gemrest/windmark-comments)

## Capsules using Windmark

[Add yours!](https://github.com/gemrest/windmark/edit/main/README.md)

- <https://fuwn.me/>

## License

This project is licensed with the
[GNU General Public License v3.0](https://github.com/gemrest/windmark/blob/main/LICENSE).