{currentDateTime}
+@{{ g.user['handle'] }}
+ +{% endif %} +``` + +bbsを作ります。 + +```toml:Cargo.toml +[package] +name = "rust-bbs" +version = "0.1.0" +edition = "2021" + +[dependencies] +actix-web = "4.0" +rusqlite = { version = "0.28", features = ["bundled"] } +serde = { version = "1.0", features = ["derive"] } +askama = "0.11" +``` + +```rust:src/main.rs +use actix_web::{web, App, HttpServer, HttpResponse, Responder}; +use rusqlite::{Connection, Result as SqliteResult}; +use serde::{Deserialize, Serialize}; +use askama::Template; + +#[derive(Serialize, Deserialize)] +struct Post { + id: i32, + content: String, +} + +#[derive(Template)] +#[template(path = "index.html")] +struct IndexTemplate { + posts: Vec
@comment
+ +