aboutsummaryrefslogtreecommitdiff
path: root/examples/windmark_comments.rs
diff options
context:
space:
mode:
authorFuwn <[email protected]>2022-04-01 01:08:02 -0700
committerFuwn <[email protected]>2022-04-01 01:08:02 -0700
commit7a8ce1eca588e08b085f3bb413416d2ff315d90d (patch)
treec3df9902e984b79a46dceafbc667cc14c4501b6e /examples/windmark_comments.rs
downloadwindmark-comments-7a8ce1eca588e08b085f3bb413416d2ff315d90d.tar.xz
windmark-comments-7a8ce1eca588e08b085f3bb413416d2ff315d90d.zip
feat: prep for 0.1.0
Diffstat (limited to 'examples/windmark_comments.rs')
-rw-r--r--examples/windmark_comments.rs48
1 files changed, 48 insertions, 0 deletions
diff --git a/examples/windmark_comments.rs b/examples/windmark_comments.rs
new file mode 100644
index 0000000..bfe6bed
--- /dev/null
+++ b/examples/windmark_comments.rs
@@ -0,0 +1,48 @@
+// This file is part of Windmark Comments <https://github.com/gemrest/windmark-comments>.
+// Copyright (C) 2022-2022 Fuwn <[email protected]>
+//
+// This program is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, version 3.
+//
+// This program is distributed in the hope that it will be useful, but
+// WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program. If not, see <http://www.gnu.org/licenses/>.
+//
+// Copyright (C) 2022-2022 Fuwn <[email protected]>
+// SPDX-License-Identifier: GPL-3.0-only
+
+use windmark::Response;
+
+#[windmark::main]
+async 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")
+ .attach(windmark_comments::module)
+ .mount(
+ "/",
+ Box::new(|_| {
+ Response::Success(
+ "# WINDMARK COMMENTS\nHello, World!\n=> /other To another route!"
+ .to_string(),
+ )
+ }),
+ )
+ .mount(
+ "/other",
+ Box::new(|_| {
+ Response::Success(
+ "# OTHER\nComments also show up on this route!\n=> / Back to the \
+ main route!"
+ .to_string(),
+ )
+ }),
+ )
+ .run()
+ .await
+}