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
//! Octane is a web server that's modelled after express (a very //! popular and easy to use web framework) for rust. //! //! While minimising dependencies, Octane thrives to be a high performance //! web server while being easy to use at the same time. //! //! You can find other docs at the [OctaneSite](). //! //! # Example //! //! Get started by adding the lib entry in your cargo.toml file //! //! ```toml //! octane = "0.1.1" //! ``` //! //! and then in your main.rs, //! //! ```no_run //! use octane::server::Octane; //! use octane::config::Config; //! use octane::{route, router::{Flow, Route}}; //! //! fn main() { //! let mut app = Octane::new(); //! app.add(Octane::static_dir("dir_name")); // serve a static directory //! app.get( //! "/", //! route!( //! |req, res| { //! res.send("Hello, World"); //! Flow::Stop //! } //! ), //! ); //! //! app.listen(8080).expect("Cannot establish connection"); //! } //! ``` //! and now you can see the page at http://0.0.0.0:8080. //! //! ## Features //! //! Octane divides most of the things that one might _leave_ out for //! any reason into features. These include, //! //! - `faithful`: //! - `query_strings`: //! - `cookies`: Basic cookie parsing and value handling. //! - `url_variables`: To support variables in url. //! - `raw_headers`: //! - `rustls`: To use rustls for ssl. //! - `openSSL`: To use openssl for ssl. //! - 'default`: The default set includes faithful, query_strings, cookies, //! url_variables, raw_headers. //! //! **Note**: If both `rustls` and `openSSL` features are enabled then //! octane will throw a `compile_error!` #[macro_use] extern crate lazy_static; pub mod config; pub mod constants; #[cfg(feature = "cookies")] pub mod cookies; pub mod error; pub mod file_handler; pub mod http; pub mod middlewares; pub mod path; pub mod query; pub mod request; pub mod responder; pub mod router; pub mod server; pub mod time; pub mod tls; pub mod util; // convenient aliasing for octane_json pub use octane_json as json; #[cfg(all(feature = "openSSL", feature = "rustls"))] compile_error!("openSSL and rustls are both enabled, you may want to one of those");