Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

POC: add api-only mode #221

Closed
wants to merge 3 commits into from
Closed

POC: add api-only mode #221

wants to merge 3 commits into from

Conversation

Valerioageno
Copy link
Member

Context & Description

This is the POC for adding the api-only mode to the tuono projects.

By just adding the api feature flag to tuono_lib the CLI automatically switches to the api-only mode, entirely stripping out the SSR from the project.

All the declared routes are defined like the APIs defined in the api/ folder:

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
}

Copy link
Member

@marcalexiei marcalexiei left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Dropping few review comments:

dropping comments

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should remove this file from VCS

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should remove this file from VCS

@@ -0,0 +1,7 @@
# Tuono API started

This is the starter tuono project. To download it run in your terminal:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
This is the starter tuono project. To download it run in your terminal:
This is the `tuono-api` starter project.
To download it run in your terminal:

Probably we should update also the other examples accordingly 😅

path = ".tuono/main.rs"

[dependencies]
tuono_lib = { path = "../../crates/tuono_lib/", features = ["api"]}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In the description you speak about api-only mode,
however the feature flag is just named api.
Furthermore, always in the PR description, is stated:

By just adding the api feature flag to tuono_lib the CLI automatically switches to the api-only mode, entirely stripping out the SSR from the project.

So, how about using api-only also as feature flag name?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

.tuono folder is present in the .gitignore, however files within this folder are added to version control.
Probably they were added before .gitignore was created in this folder.

We should remove them.

@Valerioageno
Copy link
Member Author

Closing now since descoped

@marcalexiei marcalexiei deleted the add-ff-to-tuono_lib branch January 19, 2025 10:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
proof of concept rust Requires rust knowledge
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants