├── .gitignore ├── Cargo.toml ├── src └── main.rs ├── LICENSE └── README.md /.gitignore: -------------------------------------------------------------------------------- 1 | # Cargo 2 | target 3 | Cargo.lock 4 | 5 | # OpenSSL 6 | *.pem 7 | -------------------------------------------------------------------------------- /Cargo.toml: -------------------------------------------------------------------------------- 1 | # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html 2 | 3 | [package] 4 | name = "windmark-starter-project" 5 | version = "0.1.0" 6 | edition = "2021" 7 | 8 | [dependencies] 9 | # Update this to the latest version! 10 | # 11 | # Gemini Server Framework 12 | windmark = "0.1.20" 13 | 14 | # Asynchronous Runtime 15 | tokio = { version = "0.2.4", features = ["full"] } 16 | 17 | -------------------------------------------------------------------------------- /src/main.rs: -------------------------------------------------------------------------------- 1 | use windmark::Response; 2 | 3 | #[windmark::main] 4 | async fn main() -> Result<(), Box> { 5 | windmark::Router::new() 6 | .set_private_key_file("windmark_starter_project_private.pem") 7 | .set_certificate_file("windmark_starter_project_public.pem") 8 | .mount("/", Box::new(|_| Response::Success("Hello, World!".into()))) 9 | .set_error_handler(Box::new(|_| { 10 | Response::PermanentFailure("This route does not exist!".into()) 11 | })) 12 | .run() 13 | .await 14 | } 15 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | This is free and unencumbered software released into the public domain. 2 | 3 | Anyone is free to copy, modify, publish, use, compile, sell, or 4 | distribute this software, either in source code form or as a compiled 5 | binary, for any purpose, commercial or non-commercial, and by any 6 | means. 7 | 8 | In jurisdictions that recognize copyright laws, the author or authors 9 | of this software dedicate any and all copyright interest in the 10 | software to the public domain. We make this dedication for the benefit 11 | of the public at large and to the detriment of our heirs and 12 | successors. We intend this dedication to be an overt act of 13 | relinquishment in perpetuity of all present and future rights to this 14 | software under copyright law. 15 | 16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 17 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 18 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 19 | IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR 20 | OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, 21 | ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 22 | OTHER DEALINGS IN THE SOFTWARE. 23 | 24 | For more information, please refer to 25 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Windmark Starter Project 2 | 3 | ## Grab the Project! 4 | 5 | Get started by cloning this project with Git and `cd`ing into it! 6 | 7 | ```shell 8 | git clone https://github.com/gemrest/windmark-starter-project 9 | cd windmark-starter-project 10 | ``` 11 | 12 | ## Generate an OpenSSL Key Pair 13 | 14 | Next, generate an OpenSSL key pair so you can identify yourself over TLS! 15 | 16 | Make sure to have OpenSSL installed on your system before running this command! 17 | 18 | You can change the name of the files, but then also make sure to change the 19 | names in the `src/main.rs` file. 20 | 21 | Before pushing to production, make sure to change the common name from 22 | "localhost" to your domain! 23 | 24 | ```shell 25 | openssl req \ 26 | -new \ 27 | -subj /CN=localhost \ 28 | -x509 \ 29 | -newkey ec \ 30 | -pkeyopt ec_paramgen_curve:prime256v1 \ 31 | -days 365 \ 32 | -nodes \ 33 | -out windmark_starter_project_public.pem \ 34 | -keyout windmark_starter_project_private.pem \ 35 | -inform pem 36 | ``` 37 | 38 | ## Building the Project 39 | 40 | Make sure to have Cargo installed (along with Rust) and run `cargo build` to 41 | build your project, or `cargo run` to run your project! 42 | 43 | ## Hack On! 44 | 45 | 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! 46 | 47 | --------------------------------------------------------------------------------