mirror of
https://github.com/mickael-kerjean/filestash.git
synced 2026-10-19 16:14:39 +00:00
26 lines
502 B
Rust
26 lines
502 B
Rust
use filestash::*;
|
|
|
|
pub struct Page;
|
|
|
|
impl App for Page {
|
|
fn new() -> Self {
|
|
Page
|
|
}
|
|
}
|
|
|
|
impl Http for Page {
|
|
fn routes(r: &mut Router<Self>) {
|
|
r.get("/api/example", &["index_headers"], Page::index);
|
|
}
|
|
}
|
|
|
|
impl Page {
|
|
fn index(&self, _req: &Request, res: &mut Response) {
|
|
res.header("Content-Type", "text/html; charset=utf-8")
|
|
.status(200)
|
|
.write(b"<!DOCTYPE html><h1>Hello from a Filestash plugin</h1>");
|
|
}
|
|
}
|
|
|
|
register!(Page: Http);
|