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

Update cycle 2.0 #27

Merged
merged 2 commits into from
Oct 10, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/types/frameworks/tonic.rs
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ pub async fn tonic() -> Result<bool, String> {
}

// append bin to Cargo.toml
let tonic_bin_append_text = "\n[lib]\npath=\"./src/lib.rs\"\n\n[[bin]]\nname=\"server\"\npath=\"./src/server.rs\"\n\n[[bin]]\nname=\"client\"\npath=\"./src/client.rs\"\n";
let tonic_bin_append_text = "\n[[bin]]\nname=\"server\"\npath=\"./src/server.rs\"\n\n[[bin]]\nname=\"client\"\npath=\"./src/client.rs\"\n";
append_at_end("Cargo.toml", tonic_bin_append_text);

std::fs::remove_file("src/main.rs").unwrap();
Expand All @@ -57,7 +57,7 @@ pub async fn tonic() -> Result<bool, String> {

download_file(&(github_raw_path.to_owned() + "server.rs"), "src/server.rs").await;
download_file(&(github_raw_path.to_owned() + "client.rs"), "src/client.rs").await;
download_file(&(github_raw_path.to_owned() + "lib.rs"), "src/lib.rs").await;
download_file(&(github_raw_path.to_owned() + "lib.rs"), "src/proto.rs").await;
download_file(
&(github_raw_path.to_owned() + "main.proto"),
"proto/main.proto",
Expand Down
3 changes: 2 additions & 1 deletion templates/frameworks/salvo.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,6 @@ async fn hello_world() -> &'static str {
async fn main() {
let pool = pool().await;
let router = Router::new().hoop(affix::inject(pool)).get(hello_world);
Server::new(TcpListener::bind("127.0.0.1:7878")).serve(router).await;
let acceptor = TcpListener::new("0.0.0.0:5800").bind().await;
Server::new(acceptor).serve(router).await;
}
4 changes: 2 additions & 2 deletions templates/frameworks/tonic/client.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
use tonic::transport::Endpoint;

mod lib;
mod proto;

use lib::hello::{greeter_client::GreeterClient, HelloRequest};
use proto::hello::{greeter_client::GreeterClient, HelloRequest};

#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
Expand Down
4 changes: 2 additions & 2 deletions templates/frameworks/tonic/server.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@ mod db;
use db::pool;
use tonic::{transport::Server, Request, Response, Status};

mod lib;
mod proto;

use crate::lib::hello::{
use crate::proto::hello::{
greeter_server::{Greeter, GreeterServer},
HelloReply, HelloRequest,
};
Expand Down