aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorHarald Eilertsen <haraldei@anduin.net>2018-01-11 22:50:56 +0100
committerHarald Eilertsen <haraldei@anduin.net>2018-01-11 22:50:56 +0100
commitbf2578d19a04adeb2438ba81280327e885c1ded9 (patch)
tree57a6fe849985526c6ef79856428edc133bf18bd7 /src
parent22bac37fcaa1b1cdf8755754184ec8b3ace313b1 (diff)
downloadrocket-blog-bf2578d19a04adeb2438ba81280327e885c1ded9.tar.gz
rocket-blog-bf2578d19a04adeb2438ba81280327e885c1ded9.tar.bz2
rocket-blog-bf2578d19a04adeb2438ba81280327e885c1ded9.zip
Move controller code to own module.
Diffstat (limited to 'src')
-rw-r--r--src/controllers/mod.rs1
-rw-r--r--src/controllers/posts_controller.rs (renamed from src/posts.rs)0
-rw-r--r--src/main.rs11
3 files changed, 10 insertions, 2 deletions
diff --git a/src/controllers/mod.rs b/src/controllers/mod.rs
new file mode 100644
index 0000000..0a95bd5
--- /dev/null
+++ b/src/controllers/mod.rs
@@ -0,0 +1 @@
+pub mod posts_controller;
diff --git a/src/posts.rs b/src/controllers/posts_controller.rs
index fde08a8..fde08a8 100644
--- a/src/posts.rs
+++ b/src/controllers/posts_controller.rs
diff --git a/src/main.rs b/src/main.rs
index 109d7d1..0bbdc2e 100644
--- a/src/main.rs
+++ b/src/main.rs
@@ -17,7 +17,8 @@ use rocket_contrib::Json;
#[macro_use] mod utils;
mod models;
mod schema;
-mod posts;
+mod controllers;
+use controllers::posts_controller;
#[derive(BartDisplay, Serialize)]
#[template = "templates/index.html"]
@@ -42,6 +43,12 @@ fn main() {
rocket::ignite()
.manage(utils::init_db_pool())
.mount("/", routes![index, index_json])
- .mount("/posts", routes![posts::new, posts::create, posts::show, posts::edit, posts::update])
+ .mount("/posts",
+ routes![
+ posts_controller::new,
+ posts_controller::create,
+ posts_controller::show,
+ posts_controller::edit,
+ posts_controller::update])
.launch();
}