website navigation test

This commit is contained in:
Ponj 2024-11-15 15:02:51 -05:00
parent 78200d2890
commit 6026d434ac
Signed by: p6nj
GPG key ID: 6FED68D87C479A59
4 changed files with 17 additions and 4 deletions

View file

@ -3,12 +3,24 @@ use rocket::{get, routes};
mod markdown;
use markdown::{Markdown, MarkdownConvertError};
type MarkdownResult = Result<Markdown, MarkdownConvertError>;
#[get("/")]
fn index() -> Result<Markdown, MarkdownConvertError> {
include_str!("../static/hello-world.md").parse()
fn index() -> MarkdownResult {
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]
async fn main() -> shuttle_rocket::ShuttleRocket {
Ok(rocket::build().mount("/", routes![index]).into())
Ok(rocket::build().mount("/", routes![index, one, two]).into())
}

View file

@ -1 +0,0 @@
<h1>Hello, world!</h1>

1
static/page1.md Normal file
View file

@ -0,0 +1 @@
Wrong page! Go to [page2](2).

1
static/page2.md Normal file
View file

@ -0,0 +1 @@
Wrong page! Go to [page1](1).