The words Under construction in black text on a yellow background with diagonal black stipes surrounding it
I'm in the process of moving my site. It's still a work in progress. Please excuse the mess and broken links.

Serve Embedded HTML With axum

TODO: Pull subtitle into page object
Code
[package]
name = "axum_cookies"
version = "0.1.0"
edition = "2021"

[dependencies]
axum = "0.6" 
tokio = { version = "1", features = ["full"] }
tower-cookies = "0.9"
Code
use axum::response::IntoResponse;
use axum::routing::get;
use axum::{response::Html, Router};
use std::net::SocketAddr;

#[tokio::main]
async fn main() {
    let routes_all = Router::new().merge(hello_route());
    let addr = SocketAddr::from(([127, 0, 0, 1], 8484));
    axum::Server::bind(&addr)
        .serve(routes_all.into_make_service())
        .await
        .unwrap();
}

fn hello_route() -> Router {
    Router::new().route("/", get(hello_handler))
}

async fn hello_handler() -> impl IntoResponse {
    Html("Hello, World".to_string())
}


Debugging Stuff

I'm moving stuff around right now. All this below is helping me figure out where to put stuff

        -- title

Serve Embedded HTML With axum

-- todo

[] Remove merge from this example
since you don't really need to do that

-- code
-- name: Cargo.toml

[package]
name = "axum_cookies"
version = "0.1.0"
edition = "2021"

[dependencies]
axum = "0.6" 
tokio = { version = "1", features = ["full"] }
tower-cookies = "0.9"


-- code

use axum::response::IntoResponse;
use axum::routing::get;
use axum::{response::Html, Router};
use std::net::SocketAddr;

#[tokio::main]
async fn main() {
    let routes_all = Router::new().merge(hello_route());
    let addr = SocketAddr::from(([127, 0, 0, 1], 8484));
    axum::Server::bind(&addr)
        .serve(routes_all.into_make_service())
        .await
        .unwrap();
}

fn hello_route() -> Router {
    Router::new().route("/", get(hello_handler))
}

async fn hello_handler() -> impl IntoResponse {
    Html("Hello, World".to_string())
}




-- categories
-- Rust 
-- axum

-- metadata
-- date: 2023-09-08 17:56:30
-- id: 2v8gfwjm
-- site: aws
-- type: post
-- status: scratch