server created
This commit is contained in:
@@ -19,3 +19,4 @@ chrono = "0.4.41"
|
||||
env_logger = "0.11.8"
|
||||
futures = "0.3.31"
|
||||
log = "0.4.27"
|
||||
actix-web = "4.11.0"
|
||||
|
||||
@@ -9,3 +9,4 @@ gotify-ws.workspace = true
|
||||
log.workspace = true
|
||||
sea-orm.workspace = true
|
||||
regex.workspace = true
|
||||
actix-web.workspace = true
|
||||
@@ -1 +1,2 @@
|
||||
pub mod location;
|
||||
pub mod test;
|
||||
|
||||
7
packages/serv/src/handler/test.rs
Normal file
7
packages/serv/src/handler/test.rs
Normal file
@@ -0,0 +1,7 @@
|
||||
use actix_web::get;
|
||||
|
||||
#[get("/test")]
|
||||
async fn test() -> String {
|
||||
// HttpResponse::Ok().body("test")
|
||||
String::from("test")
|
||||
}
|
||||
@@ -1,3 +1,4 @@
|
||||
mod handler;
|
||||
mod test;
|
||||
|
||||
#[tokio::main]
|
||||
|
||||
@@ -58,7 +58,7 @@ fn get_id_file() {
|
||||
|
||||
for line in buffer.lines() {
|
||||
// println!("line {}", line.unwrap());
|
||||
if let Some((name, id)) = split_str(line.unwrap().as_str()) {
|
||||
if let Some((_, id)) = split_str(line.unwrap().as_str()) {
|
||||
// println!("name: {}, id: {}", name, id);
|
||||
|
||||
if id.len() != 18 {
|
||||
|
||||
20
packages/serv/src/test/main/mod.rs
Normal file
20
packages/serv/src/test/main/mod.rs
Normal file
@@ -0,0 +1,20 @@
|
||||
use crate::handler::test;
|
||||
use actix_web::{App, HttpServer};
|
||||
#[tokio::test]
|
||||
async fn run_application() {
|
||||
println!("run application");
|
||||
|
||||
let serve = HttpServer::new(move || {
|
||||
let app = App::new();
|
||||
let app = app.service(test::test);
|
||||
|
||||
app
|
||||
});
|
||||
|
||||
serve
|
||||
.bind("127.0.0.1:8080")
|
||||
.expect("端口绑定失败")
|
||||
.run()
|
||||
.await
|
||||
.expect("服务启动失败");
|
||||
}
|
||||
@@ -1,3 +1,4 @@
|
||||
#[cfg(test)]
|
||||
mod base_api;
|
||||
mod id_card;
|
||||
mod main;
|
||||
|
||||
Reference in New Issue
Block a user