website navigation test
This commit is contained in:
parent
78200d2890
commit
6026d434ac
4 changed files with 17 additions and 4 deletions
18
src/main.rs
18
src/main.rs
|
@ -3,12 +3,24 @@ use rocket::{get, routes};
|
||||||
mod markdown;
|
mod markdown;
|
||||||
use markdown::{Markdown, MarkdownConvertError};
|
use markdown::{Markdown, MarkdownConvertError};
|
||||||
|
|
||||||
|
type MarkdownResult = Result<Markdown, MarkdownConvertError>;
|
||||||
|
|
||||||
#[get("/")]
|
#[get("/")]
|
||||||
fn index() -> Result<Markdown, MarkdownConvertError> {
|
fn index() -> MarkdownResult {
|
||||||
include_str!("../static/hello-world.md").parse()
|
one()
|
||||||
|
}
|
||||||
|
|
||||||
|
#[get("/1")]
|
||||||
|
fn one() -> MarkdownResult {
|
||||||
|
include_str!("../static/page1.md").parse()
|
||||||
|
}
|
||||||
|
|
||||||
|
#[get("/2")]
|
||||||
|
fn two() -> MarkdownResult {
|
||||||
|
include_str!("../static/page2.md").parse()
|
||||||
}
|
}
|
||||||
|
|
||||||
#[shuttle_runtime::main]
|
#[shuttle_runtime::main]
|
||||||
async fn main() -> shuttle_rocket::ShuttleRocket {
|
async fn main() -> shuttle_rocket::ShuttleRocket {
|
||||||
Ok(rocket::build().mount("/", routes![index]).into())
|
Ok(rocket::build().mount("/", routes![index, one, two]).into())
|
||||||
}
|
}
|
||||||
|
|
|
@ -1 +0,0 @@
|
||||||
<h1>Hello, world!</h1>
|
|
1
static/page1.md
Normal file
1
static/page1.md
Normal file
|
@ -0,0 +1 @@
|
||||||
|
Wrong page! Go to [page2](2).
|
1
static/page2.md
Normal file
1
static/page2.md
Normal file
|
@ -0,0 +1 @@
|
||||||
|
Wrong page! Go to [page1](1).
|
Loading…
Reference in a new issue