summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorSoniEx2 <endermoneymod@gmail.com>2021-06-12 19:18:15 -0300
committerSoniEx2 <endermoneymod@gmail.com>2021-06-12 19:18:15 -0300
commit5fd2833719bb0a8c87b38c1419ea92029a7e4d81 (patch)
tree1a26b3f8a722d5afc69e10cb46db38a41443e737
parent698402eab950622464d3e876d60d7a02eb5ab358 (diff)
Add demo
-rw-r--r--src/bin/testserver-demo.rs49
1 files changed, 49 insertions, 0 deletions
diff --git a/src/bin/testserver-demo.rs b/src/bin/testserver-demo.rs
new file mode 100644
index 0000000..74ea752
--- /dev/null
+++ b/src/bin/testserver-demo.rs
@@ -0,0 +1,49 @@
+// Testserver demo
+// Copyright (C) 2021  Soni L.
+// 
+// This program is free software: you can redistribute it and/or modify
+// it under the terms of the GNU Affero General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+// 
+// 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 Affero General Public License for more details.
+// 
+// You should have received a copy of the GNU Affero General Public License
+// along with this program.  If not, see <https://www.gnu.org/licenses/>.
+
+static DEMO: &'static str =
+r###"!<arch>
+page.xhtml.t/   0           0     0     644     663       `
+<!DOCTYPE html>
+<html xmlns="http://www.w3.org/1999/xhtml" lang="en">
+	<head>
+		<meta charset="UTF-8" />
+		<meta http-equiv="X-UA-Compatible" content="IE=edge" />
+		<meta name="viewport" content="width=device-width, initial-scale=1" />
+		<title>Testserver Demo</title>
+	</head>
+	<body>
+		<main>
+			<h1>Testserver Demo</h1>
+			<p>Simple demo of the testserver. Check the source file for details.</p>
+		</main>
+		<footer>
+			<hr />
+			<p>The contents of this webpage are licensed under a <a rel="license" href="https://creativecommons.org/licenses/by-sa/4.0/">Creative Commons Attribution-ShareAlike 4.0 International License</a>.</p>
+		</footer>
+	</body>
+</html>
+
+
+"###;
+
+fn main() {
+    let server = testserver::serve(DEMO);
+    println!("Listening on http://127.74.137.226:{}/page.xhtml", server.port());
+    println!("Type anything to exit.");
+    let _ = std::io::stdin().read_line(&mut String::new());
+    drop(server);
+}