mirror of
https://github.com/DefectingCat/phthonus
synced 2025-07-15 08:31:33 +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
|
||||
CROSS = cross
|
||||
|
||||
@ -7,7 +9,7 @@ all: build
|
||||
build:
|
||||
$(CARGO) build
|
||||
|
||||
release: clean
|
||||
release:
|
||||
$(CARGO) build --release
|
||||
|
||||
dev:
|
||||
@ -53,10 +55,4 @@ freebsd: clean-release
|
||||
loongarch: clean-release
|
||||
$(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
|
||||
|
@ -20,6 +20,7 @@ use crate::{
|
||||
};
|
||||
|
||||
pub mod json;
|
||||
pub mod text;
|
||||
|
||||
#[derive(Debug, Serialize)]
|
||||
pub struct RouteResponse<T>
|
||||
@ -57,6 +58,7 @@ pub fn routes() -> Router {
|
||||
let router = Router::new()
|
||||
.route("/", get(hello).post(hello))
|
||||
.route("/json", get(json::json).post(json::json))
|
||||
.route("/text", get(text::text).post(text::text))
|
||||
.layer(
|
||||
ServiceBuilder::new()
|
||||
.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