This commit is contained in:
lkness 2024-07-15 22:23:04 +08:00
parent 536c959e3e
commit a57dd55785
24 changed files with 43 additions and 1 deletions

View File

@ -1,3 +1,4 @@
workspace = { members = ["apps/account/domain/repo"] }
[package]
name = "sold"
version = "0.1.0"
@ -6,3 +7,4 @@ edition = "2021"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[dependencies]
actix-web = "4"

View File

View File

View File

6
src/apps/account/mod.rs Normal file
View File

@ -0,0 +1,6 @@
mod service;
mod server;
pub fn boot() {
start_server();
}

View File

@ -0,0 +1,5 @@
mod server;
pub fn start_server() {
server::start_server()
}

View File

@ -0,0 +1,16 @@
use actix_web::{get, web, App, HttpServer, Responder};
#[get("/hello/{name}")]
async fn greet(name: web::Path<String>) -> impl Responder {
format!("Hello {name}!")
}
pub fn start_server() -> std::io::Result<()> {
HttpServer::new(|| {
App::new().service(greet)
})
.bind(("127.0.0.1", 8080))?
.run()
.await
}

View File

@ -0,0 +1 @@
mod service;

View File

View File

View File

View File

View File

0
src/apps/order/mod.rs Normal file
View File

View File

View File

View File

View File

View File

View File

@ -0,0 +1,5 @@
use crate::apps::account as account;
fn start_apps() {
account::boot()
}

View File

@ -0,0 +1 @@
pub mod boot;

2
src/lib.rs Normal file
View File

@ -0,0 +1,2 @@
pub mod all_in_one;
use apps::account;

View File

@ -1,3 +1,7 @@
fn main() {
use crate::account;
use apps::account;
#[actix_web::main] // or #[tokio::main]
async fn main() -> std::io::Result<()> {
println!("Hello, world!");
}