Compare commits
2 Commits
master
...
message-qu
Author | SHA1 | Date | |
---|---|---|---|
7ada37f005 | |||
0a12cfcd57 |
98
backend/public/Cargo.lock
generated
98
backend/public/Cargo.lock
generated
@ -104,7 +104,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
|||||||
checksum = "8f43644eed690f5374f1af436ecd6aea01cd201f6fbdf0178adaf6907afb2cec"
|
checksum = "8f43644eed690f5374f1af436ecd6aea01cd201f6fbdf0178adaf6907afb2cec"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"async-trait",
|
"async-trait",
|
||||||
"axum-core",
|
"axum-core 0.4.4",
|
||||||
"bytes",
|
"bytes",
|
||||||
"futures-util",
|
"futures-util",
|
||||||
"http",
|
"http",
|
||||||
@ -113,7 +113,7 @@ dependencies = [
|
|||||||
"hyper",
|
"hyper",
|
||||||
"hyper-util",
|
"hyper-util",
|
||||||
"itoa",
|
"itoa",
|
||||||
"matchit",
|
"matchit 0.7.3",
|
||||||
"memchr",
|
"memchr",
|
||||||
"mime",
|
"mime",
|
||||||
"percent-encoding",
|
"percent-encoding",
|
||||||
@ -123,9 +123,43 @@ dependencies = [
|
|||||||
"serde_json",
|
"serde_json",
|
||||||
"serde_path_to_error",
|
"serde_path_to_error",
|
||||||
"serde_urlencoded",
|
"serde_urlencoded",
|
||||||
"sync_wrapper 1.0.1",
|
"sync_wrapper",
|
||||||
"tokio",
|
"tokio",
|
||||||
"tower 0.5.1",
|
"tower 0.5.2",
|
||||||
|
"tower-layer",
|
||||||
|
"tower-service",
|
||||||
|
"tracing",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "axum"
|
||||||
|
version = "0.8.4"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "021e862c184ae977658b36c4500f7feac3221ca5da43e3f25bd04ab6c79a29b5"
|
||||||
|
dependencies = [
|
||||||
|
"axum-core 0.5.2",
|
||||||
|
"bytes",
|
||||||
|
"form_urlencoded",
|
||||||
|
"futures-util",
|
||||||
|
"http",
|
||||||
|
"http-body",
|
||||||
|
"http-body-util",
|
||||||
|
"hyper",
|
||||||
|
"hyper-util",
|
||||||
|
"itoa",
|
||||||
|
"matchit 0.8.4",
|
||||||
|
"memchr",
|
||||||
|
"mime",
|
||||||
|
"percent-encoding",
|
||||||
|
"pin-project-lite",
|
||||||
|
"rustversion",
|
||||||
|
"serde",
|
||||||
|
"serde_json",
|
||||||
|
"serde_path_to_error",
|
||||||
|
"serde_urlencoded",
|
||||||
|
"sync_wrapper",
|
||||||
|
"tokio",
|
||||||
|
"tower 0.5.2",
|
||||||
"tower-layer",
|
"tower-layer",
|
||||||
"tower-service",
|
"tower-service",
|
||||||
"tracing",
|
"tracing",
|
||||||
@ -146,7 +180,27 @@ dependencies = [
|
|||||||
"mime",
|
"mime",
|
||||||
"pin-project-lite",
|
"pin-project-lite",
|
||||||
"rustversion",
|
"rustversion",
|
||||||
"sync_wrapper 1.0.1",
|
"sync_wrapper",
|
||||||
|
"tower-layer",
|
||||||
|
"tower-service",
|
||||||
|
"tracing",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "axum-core"
|
||||||
|
version = "0.5.2"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "68464cd0412f486726fb3373129ef5d2993f90c34bc2bc1c1e9943b2f4fc7ca6"
|
||||||
|
dependencies = [
|
||||||
|
"bytes",
|
||||||
|
"futures-core",
|
||||||
|
"http",
|
||||||
|
"http-body",
|
||||||
|
"http-body-util",
|
||||||
|
"mime",
|
||||||
|
"pin-project-lite",
|
||||||
|
"rustversion",
|
||||||
|
"sync_wrapper",
|
||||||
"tower-layer",
|
"tower-layer",
|
||||||
"tower-service",
|
"tower-service",
|
||||||
"tracing",
|
"tracing",
|
||||||
@ -901,9 +955,9 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "libc"
|
name = "libc"
|
||||||
version = "0.2.158"
|
version = "0.2.174"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "d8adc4bb1803a324070e64a98ae98f38934d91957a99cfb3a43dcbc01bc56439"
|
checksum = "1171693293099992e19cddea4e8b849964e9846f4acee11b3948bcc337be8776"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "libm"
|
name = "libm"
|
||||||
@ -959,6 +1013,12 @@ version = "0.7.3"
|
|||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "0e7465ac9959cc2b1404e8e2367b43684a6d13790fe23056cc8c6c5a6b7bcb94"
|
checksum = "0e7465ac9959cc2b1404e8e2367b43684a6d13790fe23056cc8c6c5a6b7bcb94"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "matchit"
|
||||||
|
version = "0.8.4"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "47e1ffaa40ddd1f3ed91f717a33c8c0ee23fff369e3aa8772b9605cc1d22f4c3"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "md-5"
|
name = "md-5"
|
||||||
version = "0.10.6"
|
version = "0.10.6"
|
||||||
@ -1251,7 +1311,7 @@ dependencies = [
|
|||||||
name = "public"
|
name = "public"
|
||||||
version = "0.1.0"
|
version = "0.1.0"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"axum",
|
"axum 0.8.4",
|
||||||
"chrono",
|
"chrono",
|
||||||
"dotenvy",
|
"dotenvy",
|
||||||
"fred",
|
"fred",
|
||||||
@ -1920,12 +1980,6 @@ dependencies = [
|
|||||||
"unicode-ident",
|
"unicode-ident",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "sync_wrapper"
|
|
||||||
version = "0.1.2"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "2047c6ded9c721764247e62cd3b03c09ffc529b2ba5b10ec482ae507a4a70160"
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "sync_wrapper"
|
name = "sync_wrapper"
|
||||||
version = "1.0.1"
|
version = "1.0.1"
|
||||||
@ -1992,9 +2046,9 @@ checksum = "1f3ccbac311fea05f86f61904b462b55fb3df8837a366dfc601a0161d0532f20"
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "tokio"
|
name = "tokio"
|
||||||
version = "1.40.0"
|
version = "1.45.1"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "e2b070231665d27ad9ec9b8df639893f46727666c6767db40317fbe920a5d998"
|
checksum = "75ef51a33ef1da925cea3e4eb122833cb377c61439ca401b770f54902b806779"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"backtrace",
|
"backtrace",
|
||||||
"bytes",
|
"bytes",
|
||||||
@ -2010,9 +2064,9 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "tokio-macros"
|
name = "tokio-macros"
|
||||||
version = "2.4.0"
|
version = "2.5.0"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "693d596312e88961bc67d7f1f97af8a70227d9f90c31bba5806eec004978d752"
|
checksum = "6e06d43f1345a3bcd39f6a56dbb7dcab2ba47e68e8ac134855e7e2bdbaf8cab8"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"proc-macro2",
|
"proc-macro2",
|
||||||
"quote",
|
"quote",
|
||||||
@ -2061,14 +2115,14 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "tower"
|
name = "tower"
|
||||||
version = "0.5.1"
|
version = "0.5.2"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "2873938d487c3cfb9aed7546dc9f2711d867c9f90c46b889989a2cb84eba6b4f"
|
checksum = "d039ad9159c98b70ecfd540b2573b97f7f52c3e8d9f8ad57a24b916a536975f9"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"futures-core",
|
"futures-core",
|
||||||
"futures-util",
|
"futures-util",
|
||||||
"pin-project-lite",
|
"pin-project-lite",
|
||||||
"sync_wrapper 0.1.2",
|
"sync_wrapper",
|
||||||
"tokio",
|
"tokio",
|
||||||
"tower-layer",
|
"tower-layer",
|
||||||
"tower-service",
|
"tower-service",
|
||||||
@ -2109,7 +2163,7 @@ version = "0.4.2"
|
|||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "313fa625fea5790ed56360a30ea980e41229cf482b4835801a67ef1922bf63b9"
|
checksum = "313fa625fea5790ed56360a30ea980e41229cf482b4835801a67ef1922bf63b9"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"axum",
|
"axum 0.7.6",
|
||||||
"forwarded-header-value",
|
"forwarded-header-value",
|
||||||
"governor",
|
"governor",
|
||||||
"http",
|
"http",
|
||||||
|
@ -7,7 +7,7 @@ authors = ["Wyatt J. Miller <wyatt@wyattjmiller.com"]
|
|||||||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
axum = { version = "0.7.6", features = ["http2", "tokio"] }
|
axum = { version = "0.8.4", features = ["http2", "tokio"] }
|
||||||
tower-http = { version = "0.6.1", features = ["trace", "cors"] }
|
tower-http = { version = "0.6.1", features = ["trace", "cors"] }
|
||||||
tower_governor = "0.4.2"
|
tower_governor = "0.4.2"
|
||||||
tokio = { version = "1.40.0", features = ["full"] }
|
tokio = { version = "1.40.0", features = ["full"] }
|
||||||
|
@ -121,20 +121,11 @@ async fn main() {
|
|||||||
|
|
||||||
// build our application with some routes
|
// build our application with some routes
|
||||||
let app = Router::new()
|
let app = Router::new()
|
||||||
.nest("/", routes::root::RootRoute::routes())
|
.merge(routes::root::RootRoute::routes())
|
||||||
.nest("/posts", routes::posts::PostsRoute::routes(&app_state))
|
.merge(routes::posts::PostsRoute::routes(&app_state))
|
||||||
.nest(
|
.merge(routes::comments::CommentsRoute::routes(&app_state))
|
||||||
"/comments",
|
.merge(routes::authors::AuthorsRoute::routes(&app_state))
|
||||||
routes::comments::CommentsRoute::routes(&app_state),
|
.merge(routes::projects::ProjectsRoute::routes(&app_state))
|
||||||
)
|
|
||||||
.nest(
|
|
||||||
"/authors",
|
|
||||||
routes::authors::AuthorsRoute::routes(&app_state),
|
|
||||||
)
|
|
||||||
.nest(
|
|
||||||
"/projects",
|
|
||||||
routes::projects::ProjectsRoute::routes(&app_state),
|
|
||||||
)
|
|
||||||
.layer(CorsLayer::permissive())
|
.layer(CorsLayer::permissive())
|
||||||
.layer(
|
.layer(
|
||||||
TraceLayer::new_for_http()
|
TraceLayer::new_for_http()
|
||||||
|
@ -30,9 +30,9 @@ pub struct AuthorsRoute;
|
|||||||
impl AuthorsRoute {
|
impl AuthorsRoute {
|
||||||
pub fn routes(app_state: &AppState) -> axum::Router {
|
pub fn routes(app_state: &AppState) -> axum::Router {
|
||||||
axum::Router::new()
|
axum::Router::new()
|
||||||
.route("/", get(AuthorsRoute::get_all))
|
.route("/authors", get(AuthorsRoute::get_all))
|
||||||
.route("/:id", get(AuthorsRoute::get_one))
|
.route("/authors/{id}", get(AuthorsRoute::get_one))
|
||||||
.route("/:id/posts", get(AuthorsRoute::get_authors_posts))
|
.route("/authors/{id}/posts", get(AuthorsRoute::get_authors_posts))
|
||||||
.with_state(app_state.clone())
|
.with_state(app_state.clone())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -43,9 +43,9 @@ impl CommentsRoute {
|
|||||||
pub fn routes(app_state: &AppState) -> axum::Router {
|
pub fn routes(app_state: &AppState) -> axum::Router {
|
||||||
// add more comment routes here!
|
// add more comment routes here!
|
||||||
axum::Router::new()
|
axum::Router::new()
|
||||||
.route("/post/:id", get(CommentsRoute::get_post_comments))
|
.route("/comments/post/{id}", get(CommentsRoute::get_post_comments))
|
||||||
.route("/add", post(CommentsRoute::insert_comment))
|
.route("/comments/add", post(CommentsRoute::insert_comment))
|
||||||
.route("/index", get(CommentsRoute::get_comments_index))
|
.route("/comments/index", get(CommentsRoute::get_comments_index))
|
||||||
.with_state(app_state.clone())
|
.with_state(app_state.clone())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -57,14 +57,14 @@ impl PostsRoute {
|
|||||||
pub fn routes(app_state: &AppState) -> Router {
|
pub fn routes(app_state: &AppState) -> Router {
|
||||||
// add more post routes here!
|
// add more post routes here!
|
||||||
Router::new()
|
Router::new()
|
||||||
.route("/all", get(PostsRoute::get_all))
|
.route("/posts/all", get(PostsRoute::get_all))
|
||||||
.route("/:id", get(PostsRoute::get_one))
|
.route("/posts/{id}", get(PostsRoute::get_one))
|
||||||
.route("/recent", get(PostsRoute::get_recent_posts))
|
.route("/posts/recent", get(PostsRoute::get_recent_posts))
|
||||||
.route("/popular", get(PostsRoute::get_popular_posts))
|
.route("/posts/popular", get(PostsRoute::get_popular_posts))
|
||||||
.route("/hot", get(PostsRoute::get_hot_posts))
|
.route("/posts/hot", get(PostsRoute::get_hot_posts))
|
||||||
.route("/featured", get(PostsRoute::get_featured_posts))
|
.route("/posts/featured", get(PostsRoute::get_featured_posts))
|
||||||
.route("/rss", get(PostsRoute::get_rss_posts))
|
.route("/posts/rss", get(PostsRoute::get_rss_posts))
|
||||||
.route("/sitemap", get(PostsRoute::get_sitemap))
|
.route("/posts/sitemap", get(PostsRoute::get_sitemap))
|
||||||
.with_state(app_state.clone())
|
.with_state(app_state.clone())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -21,7 +21,7 @@ pub struct ProjectsRoute;
|
|||||||
impl ProjectsRoute {
|
impl ProjectsRoute {
|
||||||
pub fn routes(app_state: &AppState) -> Router {
|
pub fn routes(app_state: &AppState) -> Router {
|
||||||
Router::new()
|
Router::new()
|
||||||
.route("/", get(ProjectsRoute::get_all))
|
.route("/projects", get(ProjectsRoute::get_all))
|
||||||
.with_state(app_state.clone())
|
.with_state(app_state.clone())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
2
backend/queue/.gitignore
vendored
Normal file
2
backend/queue/.gitignore
vendored
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
target/
|
||||||
|
.env
|
7
backend/queue/Cargo.lock
generated
Normal file
7
backend/queue/Cargo.lock
generated
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
# This file is automatically @generated by Cargo.
|
||||||
|
# It is not intended for manual editing.
|
||||||
|
version = 4
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "queue"
|
||||||
|
version = "0.1.0"
|
6
backend/queue/Cargo.toml
Normal file
6
backend/queue/Cargo.toml
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
[package]
|
||||||
|
name = "queue"
|
||||||
|
version = "0.1.0"
|
||||||
|
edition = "2024"
|
||||||
|
|
||||||
|
[dependencies]
|
14
backend/queue/src/lib.rs
Normal file
14
backend/queue/src/lib.rs
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
pub fn add(left: u64, right: u64) -> u64 {
|
||||||
|
left + right
|
||||||
|
}
|
||||||
|
|
||||||
|
#[cfg(test)]
|
||||||
|
mod tests {
|
||||||
|
use super::*;
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn it_works() {
|
||||||
|
let result = add(2, 2);
|
||||||
|
assert_eq!(result, 4);
|
||||||
|
}
|
||||||
|
}
|
Reference in New Issue
Block a user