mirror of
https://github.com/tuono-labs/tuono
synced 2026-07-25 12:52:47 -07:00
feat: add tuono-api example
This commit is contained in:
@@ -9,6 +9,7 @@ exclude = [
|
|||||||
"apps/documentation",
|
"apps/documentation",
|
||||||
"examples/with-mdx",
|
"examples/with-mdx",
|
||||||
"examples/tuono-app",
|
"examples/tuono-app",
|
||||||
|
"examples/tuono-api",
|
||||||
"examples/tuono-tutorial",
|
"examples/tuono-tutorial",
|
||||||
"benches/tuono"
|
"benches/tuono"
|
||||||
]
|
]
|
||||||
|
|||||||
@@ -0,0 +1,2 @@
|
|||||||
|
.tuono
|
||||||
|
target
|
||||||
@@ -0,0 +1,12 @@
|
|||||||
|
[package]
|
||||||
|
name = "tuono-api"
|
||||||
|
version = "0.0.1"
|
||||||
|
edition = "2021"
|
||||||
|
|
||||||
|
[[bin]]
|
||||||
|
name = "tuono"
|
||||||
|
path = ".tuono/main.rs"
|
||||||
|
|
||||||
|
[dependencies]
|
||||||
|
tuono_lib = { path = "../../crates/tuono_lib/", features = ["api"]}
|
||||||
|
|
||||||
@@ -0,0 +1,7 @@
|
|||||||
|
# Tuono API started
|
||||||
|
|
||||||
|
This is the starter tuono project. To download it run in your terminal:
|
||||||
|
|
||||||
|
```shell
|
||||||
|
$ tuono new [NAME] --template tuono-api
|
||||||
|
```
|
||||||
@@ -0,0 +1,12 @@
|
|||||||
|
use tuono_lib::axum::http::StatusCode;
|
||||||
|
use tuono_lib::Request;
|
||||||
|
|
||||||
|
#[tuono_lib::api(GET)]
|
||||||
|
pub async fn root_route_api(_req: Request) -> &'static str {
|
||||||
|
"get request"
|
||||||
|
}
|
||||||
|
|
||||||
|
#[tuono_lib::api(POST)]
|
||||||
|
pub async fn root_route_api_post(_req: Request) -> StatusCode {
|
||||||
|
StatusCode::OK
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user