init tera and html lsp

This commit is contained in:
Per Stark
2024-12-03 13:26:17 +01:00
parent 5d1e48d493
commit 1fad4a5b1a
7 changed files with 252 additions and 1 deletions

View File

@@ -4,6 +4,7 @@ use axum::{
Extension, Router,
};
use std::sync::Arc;
use tera::Tera;
use tracing_subscriber::{fmt, prelude::*, EnvFilter};
use zettle_db::{
rabbitmq::{publisher::RabbitMQProducer, RabbitMQConfig},
@@ -25,6 +26,8 @@ async fn main() -> Result<(), Box<dyn std::error::Error>> {
.try_init()
.ok();
let tera = Tera::new("src/server/templates/**/*.html").unwrap();
// Set up RabbitMQ
let config = RabbitMQConfig {
amqp_addr: "amqp://localhost".to_string(),
@@ -50,7 +53,12 @@ async fn main() -> Result<(), Box<dyn std::error::Error>> {
.route("/file/:uuid", put(update_file_handler))
.route("/file/:uuid", delete(delete_file_handler))
.route("/query", post(query_handler))
.layer(Extension(db_client));
.layer(Extension(db_client))
.route(
"/hello_world",
get(zettle_db::server::routes::hello_world::hello_world_handler),
)
.layer(Extension(tera));
tracing::info!("Listening on 0.0.0.0:3000");
let listener = tokio::net::TcpListener::bind("0.0.0.0:3000").await?;