Add lib.rs, scaffold testing
This commit is contained in:
parent
99d05223d7
commit
d9a6938eb6
11 changed files with 57 additions and 14 deletions
|
|
@ -45,6 +45,7 @@ fn make_body(code: Option<u16>, message: Option<&str>) -> String {
|
|||
.0
|
||||
}
|
||||
|
||||
#[expect(clippy::unused_async)]
|
||||
pub async fn not_found() -> Response<Body> {
|
||||
by_code(
|
||||
Some(404),
|
||||
|
|
|
|||
|
|
@ -8,6 +8,8 @@ use crate::{
|
|||
};
|
||||
use crate::handlers;
|
||||
|
||||
/// # Panics
|
||||
/// Will panic if file read fails.
|
||||
pub async fn file(file_path: &str, content_type: &str) -> Response<Body> {
|
||||
let content = match std::fs::read(file_path) {
|
||||
Ok(s) => s,
|
||||
|
|
|
|||
|
|
@ -2,6 +2,7 @@ use axum::{body::Body, extract::Path, http::Response};
|
|||
|
||||
use crate::{formats::populate_graph, handlers, types::Node};
|
||||
|
||||
#[expect(clippy::unused_async)]
|
||||
pub async fn node(Path(id): Path<String>) -> Response<Body> {
|
||||
let mut context = tera::Context::new();
|
||||
|
||||
|
|
|
|||
|
|
@ -20,6 +20,7 @@ pub async fn nexus(template: &str) -> Response<Body> {
|
|||
handlers::template::by_filename(template, &context, 500, None, false)
|
||||
}
|
||||
|
||||
#[expect(clippy::unused_async)]
|
||||
pub async fn search(Form(query): Form<Query>) -> Redirect {
|
||||
Redirect::permanent(format!("/node/{}", query.node).as_str())
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue