mirror of
https://github.com/DefectingCat/phthonus
synced 2025-07-15 16:41:32 +00:00
feat(axum): add plain text
This commit is contained in:
@ -1,4 +1,6 @@
|
|||||||
CARGO = cargo
|
RUSTFLAGS := "-Z threads=8 -C target-cpu=native"
|
||||||
|
|
||||||
|
CARGO = RUSTFLAGS=$(RUSTFLAGS) cargo
|
||||||
RUSTC = rustc
|
RUSTC = rustc
|
||||||
CROSS = cross
|
CROSS = cross
|
||||||
|
|
||||||
@ -7,7 +9,7 @@ all: build
|
|||||||
build:
|
build:
|
||||||
$(CARGO) build
|
$(CARGO) build
|
||||||
|
|
||||||
release: clean
|
release:
|
||||||
$(CARGO) build --release
|
$(CARGO) build --release
|
||||||
|
|
||||||
dev:
|
dev:
|
||||||
@ -53,10 +55,4 @@ freebsd: clean-release
|
|||||||
loongarch: clean-release
|
loongarch: clean-release
|
||||||
$(CROSS) build --release --target loongarch64-unknown-linux-gnu
|
$(CROSS) build --release --target loongarch64-unknown-linux-gnu
|
||||||
|
|
||||||
deps:
|
|
||||||
python -m venv venus \
|
|
||||||
&& source venus/bin/activate \
|
|
||||||
&& pip install -r scripts/requirements.txt \
|
|
||||||
&& python scripts/download-core.py
|
|
||||||
|
|
||||||
.PHONY: all
|
.PHONY: all
|
||||||
|
@ -20,6 +20,7 @@ use crate::{
|
|||||||
};
|
};
|
||||||
|
|
||||||
pub mod json;
|
pub mod json;
|
||||||
|
pub mod text;
|
||||||
|
|
||||||
#[derive(Debug, Serialize)]
|
#[derive(Debug, Serialize)]
|
||||||
pub struct RouteResponse<T>
|
pub struct RouteResponse<T>
|
||||||
@ -57,6 +58,7 @@ pub fn routes() -> Router {
|
|||||||
let router = Router::new()
|
let router = Router::new()
|
||||||
.route("/", get(hello).post(hello))
|
.route("/", get(hello).post(hello))
|
||||||
.route("/json", get(json::json).post(json::json))
|
.route("/json", get(json::json).post(json::json))
|
||||||
|
.route("/text", get(text::text).post(text::text))
|
||||||
.layer(
|
.layer(
|
||||||
ServiceBuilder::new()
|
ServiceBuilder::new()
|
||||||
.layer(middleware::from_fn(add_version))
|
.layer(middleware::from_fn(add_version))
|
||||||
|
5
frameworks/Rust/axum/src/routes/text.rs
Normal file
5
frameworks/Rust/axum/src/routes/text.rs
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
use axum::response::IntoResponse;
|
||||||
|
|
||||||
|
pub async fn text() -> impl IntoResponse {
|
||||||
|
"xfy"
|
||||||
|
}
|
Reference in New Issue
Block a user