From f589619c321b90ab5607a2d1680f27a6c688b59b Mon Sep 17 00:00:00 2001 From: giripriyadarshan <43517605+giripriyadarshan@users.noreply.github.com> Date: Tue, 10 Oct 2023 19:48:32 +0530 Subject: [PATCH 1/2] salvo update --- templates/frameworks/salvo.rs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/templates/frameworks/salvo.rs b/templates/frameworks/salvo.rs index 56b71d2..66628e9 100644 --- a/templates/frameworks/salvo.rs +++ b/templates/frameworks/salvo.rs @@ -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; } From 6c205fb02d4aa5795d6a0f912b67174cc7bdb5a5 Mon Sep 17 00:00:00 2001 From: giripriyadarshan <43517605+giripriyadarshan@users.noreply.github.com> Date: Tue, 10 Oct 2023 19:48:38 +0530 Subject: [PATCH 2/2] tonic update --- src/types/frameworks/tonic.rs | 4 ++-- templates/frameworks/tonic/client.rs | 4 ++-- templates/frameworks/tonic/server.rs | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/types/frameworks/tonic.rs b/src/types/frameworks/tonic.rs index 1619671..6190748 100644 --- a/src/types/frameworks/tonic.rs +++ b/src/types/frameworks/tonic.rs @@ -46,7 +46,7 @@ pub async fn tonic() -> Result { } // 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(); @@ -57,7 +57,7 @@ pub async fn tonic() -> Result { 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", diff --git a/templates/frameworks/tonic/client.rs b/templates/frameworks/tonic/client.rs index ff4b1bf..624809a 100644 --- a/templates/frameworks/tonic/client.rs +++ b/templates/frameworks/tonic/client.rs @@ -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> { diff --git a/templates/frameworks/tonic/server.rs b/templates/frameworks/tonic/server.rs index 8e7690d..1ec9a71 100644 --- a/templates/frameworks/tonic/server.rs +++ b/templates/frameworks/tonic/server.rs @@ -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, };