aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--examples/tutorial01/main.rs11
-rw-r--r--src/lib.rs17
-rw-r--r--src/settings.rs10
3 files changed, 34 insertions, 4 deletions
diff --git a/examples/tutorial01/main.rs b/examples/tutorial01/main.rs
index 62c32cd..4db9897 100644
--- a/examples/tutorial01/main.rs
+++ b/examples/tutorial01/main.rs
@@ -1,16 +1,21 @@
+use tosin::Settings;
use tosin::contrib::admin;
use tosin::http::Filter;
use tosin::urls::{UrlMap, path};
mod polls;
-pub fn urls() -> UrlMap {
+fn urls() -> UrlMap {
path!("polls" / ..).and(polls::urls::urls())
.or(path!("admin" / ..).and(admin::site::urls::urls()))
.unify()
.boxed()
}
-fn main() {
- tosin::run_server(urls());
+fn settings() -> Settings {
+ Settings {
+ ..Settings::default()
+ }
}
+
+tosin::main!(urls(), settings());
diff --git a/src/lib.rs b/src/lib.rs
index b9cf73d..112ed57 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -1,6 +1,21 @@
pub mod contrib;
pub mod http;
pub mod server;
+pub mod settings;
pub mod urls;
-pub use server::run_server;
+pub use settings::Settings;
+pub use urls::UrlMap;
+
+pub fn main(urls: UrlMap, settings: Settings) {
+ todo!()
+}
+
+#[macro_export]
+macro_rules! main {
+ ($urls:expr, $settings:expr) => {
+ fn main() {
+ tosin::main($urls, $settings);
+ }
+ };
+}
diff --git a/src/settings.rs b/src/settings.rs
new file mode 100644
index 0000000..9d29cfe
--- /dev/null
+++ b/src/settings.rs
@@ -0,0 +1,10 @@
+pub struct Settings {
+}
+
+impl Default for Settings {
+ fn default() -> Self {
+ Self {
+
+ }
+ }
+}