Moved hello world to own module
This commit is contained in:
parent
b49a01ab03
commit
57de7c66b3
7 changed files with 9 additions and 5 deletions
0
src/hello/controller.rs
Normal file
0
src/hello/controller.rs
Normal file
1
src/hello/mod.rs
Normal file
1
src/hello/mod.rs
Normal file
|
|
@ -0,0 +1 @@
|
|||
pub mod routes;
|
||||
4
src/hello/routes.rs
Normal file
4
src/hello/routes.rs
Normal file
|
|
@ -0,0 +1,4 @@
|
|||
#[get("/world")]
|
||||
pub fn world() -> &'static str {
|
||||
"Hello, world!"
|
||||
}
|
||||
1
src/ivago/controller.rs
Normal file
1
src/ivago/controller.rs
Normal file
|
|
@ -0,0 +1 @@
|
|||
mod ivago.controller;
|
||||
0
src/ivago/mod.rs
Normal file
0
src/ivago/mod.rs
Normal file
1
src/ivago/routes.rs
Normal file
1
src/ivago/routes.rs
Normal file
|
|
@ -0,0 +1 @@
|
|||
mod ivago.routes;
|
||||
|
|
@ -2,11 +2,8 @@
|
|||
|
||||
#[macro_use] extern crate rocket;
|
||||
|
||||
#[get("/")]
|
||||
fn index() -> &'static str {
|
||||
"Hello, world!"
|
||||
}
|
||||
mod hello;
|
||||
|
||||
fn main() {
|
||||
rocket::ignite().mount("/", routes![index]).launch();
|
||||
rocket::ignite().mount("/hello", routes![hello::routes::world]).launch();
|
||||
}
|
||||
|
|
|
|||
Reference in a new issue