feat: add tuono-api example

This commit is contained in:
Valerio Ageno
2024-12-14 12:11:14 +01:00
parent adf7ba5391
commit 12a2144a0d
6 changed files with 34 additions and 0 deletions
+1
View File
@@ -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"
] ]
+2
View File
@@ -0,0 +1,2 @@
.tuono
target
+12
View File
@@ -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"]}
+7
View File
@@ -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
```
View File
+12
View File
@@ -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
}