Typstify /tictactoe endpoint
This commit is contained in:
parent
d32be913fd
commit
8bece23baf
8 changed files with 64 additions and 84 deletions
|
|
@ -12,7 +12,7 @@ use tokio::{net::TcpListener, sync::mpsc};
|
|||
|
||||
use crate::{
|
||||
documents,
|
||||
drawer::{ChatMessageDrawing, Command, TicTacToeDrawing},
|
||||
drawer::{ChatMessageDrawing, Command},
|
||||
};
|
||||
|
||||
use self::r#static::get_static_file;
|
||||
|
|
@ -42,7 +42,10 @@ pub async fn run(tx: mpsc::Sender<Command>, addr: String) -> anyhow::Result<()>
|
|||
"/text",
|
||||
post(documents::text::post).fallback(get_static_file),
|
||||
)
|
||||
.route("/tictactoe", post(post_tictactoe))
|
||||
.route(
|
||||
"/tictactoe",
|
||||
post(documents::tictactoe::post).fallback(get_static_file),
|
||||
)
|
||||
.fallback(get(get_static_file))
|
||||
.layer(DefaultBodyLimit::max(32 * 1024 * 1024)) // 32 MiB
|
||||
.with_state(Server { tx });
|
||||
|
|
@ -69,9 +72,3 @@ async fn post_chat_message(server: State<Server>, request: Form<PostChatMessageF
|
|||
}))
|
||||
.await;
|
||||
}
|
||||
|
||||
// /tictactoe
|
||||
|
||||
async fn post_tictactoe(server: State<Server>) {
|
||||
let _ = server.tx.send(Command::draw(TicTacToeDrawing)).await;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue