diff options
| author | Fuwn <[email protected]> | 2022-07-31 08:40:06 -1000 |
|---|---|---|
| committer | Fuwn <[email protected]> | 2022-07-31 08:40:06 -1000 |
| commit | 70a37ee724c2a8772eacb58e315d9ad0e09f6172 (patch) | |
| tree | d678854a82e2cfdc5be7ab78c378639a3b37d071 | |
| download | windmark-starter-project-70a37ee724c2a8772eacb58e315d9ad0e09f6172.tar.xz windmark-starter-project-70a37ee724c2a8772eacb58e315d9ad0e09f6172.zip | |
feat: initial commit
| -rw-r--r-- | .gitignore | 6 | ||||
| -rw-r--r-- | Cargo.toml | 16 | ||||
| -rw-r--r-- | LICENSE | 24 | ||||
| -rw-r--r-- | README.md | 46 | ||||
| -rw-r--r-- | src/main.rs | 14 |
5 files changed, 106 insertions, 0 deletions
diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..10b88af --- /dev/null +++ b/.gitignore @@ -0,0 +1,6 @@ +# Cargo +target +Cargo.lock + +# OpenSSL +*.pem diff --git a/Cargo.toml b/Cargo.toml new file mode 100644 index 0000000..abe3d1b --- /dev/null +++ b/Cargo.toml @@ -0,0 +1,16 @@ +# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html + +[package] +name = "windmark-starter-project" +version = "0.1.0" +edition = "2021" + +[dependencies] +# Update this to the latest version! +# +# Gemini Server Framework +windmark = "0.1.20" + +# Asynchronous Runtime +tokio = { version = "0.2.4", features = ["full"] } + @@ -0,0 +1,24 @@ +This is free and unencumbered software released into the public domain. + +Anyone is free to copy, modify, publish, use, compile, sell, or +distribute this software, either in source code form or as a compiled +binary, for any purpose, commercial or non-commercial, and by any +means. + +In jurisdictions that recognize copyright laws, the author or authors +of this software dedicate any and all copyright interest in the +software to the public domain. We make this dedication for the benefit +of the public at large and to the detriment of our heirs and +successors. We intend this dedication to be an overt act of +relinquishment in perpetuity of all present and future rights to this +software under copyright law. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR +OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, +ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR +OTHER DEALINGS IN THE SOFTWARE. + +For more information, please refer to <http://unlicense.org/> diff --git a/README.md b/README.md new file mode 100644 index 0000000..62ef20e --- /dev/null +++ b/README.md @@ -0,0 +1,46 @@ +# Windmark Starter Project + +## Grab the Project! + +Get started by cloning this project with Git and `cd`ing into it! + +```shell +git clone https://github.com/gemrest/windmark-start-project +cd windmark-starter-project +``` + +## Generate an OpenSSL Key Pair + +Next, generate an OpenSSL key pair so you can identify yourself over TLS! + +Make sure to have OpenSSL installed on your system before running this command! + +You can change the name of the files, but then also make sure to change the +names in the `src/main.rs` file. + +Before pushing to production, make sure to change the common name from +"localhost" to your domain! + +```shell +openssl req \ + -new \ + -subj /CN=localhost \ + -x509 \ + -newkey ec \ + -pkeyopt ec_paramgen_curve:prime256v1 \ + -days 365 \ + -nodes \ + -out windmark_starter_project_public.pem \ + -keyout windmark_starter_project_private.pem \ + -inform pem +``` + +## Building the Project + +Make sure to have Cargo installed (along with Rust) and run `cargo build` to +build your project, or `cargo run` to run your project! + +## Hack On! + +Change whatever you'd like! Make sure to checkout the [examples directory](https://github.com/gemrest/windmark/tree/main/examples) for some useful examples of some of Windmark's features! + diff --git a/src/main.rs b/src/main.rs new file mode 100644 index 0000000..43d0743 --- /dev/null +++ b/src/main.rs @@ -0,0 +1,14 @@ +use windmark::Response; + +#[windmark::main] +async fn main() -> Result<(), Box<dyn std::error::Error>> { + windmark::Router::new() + .set_private_key_file("windmark_starter_project_private.pem") + .set_certificate_file("windmark_starter_project_public.pem") + .mount("/", Box::new(|_| Response::Success("Hello, World!".into()))) + .set_error_handler(Box::new(|_| { + Response::PermanentFailure("This route does not exist!".into()) + })) + .run() + .await +} |