This commit is contained in:
azw 2023-11-11 08:43:20 +00:00
parent de5f2e0033
commit 4185e7aa31
4 changed files with 27 additions and 4 deletions

View File

@ -1 +1,3 @@
pub mod user_app;
pub use user_app::UserApp;

View File

@ -3,6 +3,8 @@ use std::cell::RefCell;
use r9_macro::SharedFromSelf;
use r9_macro_derive::SharedFromSelf;
use r9_macro_derive::Singleton;
use f9::app::App;
use f9::app::HttpContext;
#[derive(SharedFromSelf)]
#[derive(Singleton)]
@ -13,11 +15,26 @@ pub struct UserApp {
impl f9::app::UserApp for UserApp {
fn get_pkg_name(&self) -> String {
return "".to_string();
return "statserver".to_string();
}
fn init(&mut self) {
App::instance().borrow_mut().add_http_handler(
"Ops$selfChecking".to_string(),
Box::new(
move |ctx: &mut HttpContext| {
ctx.rsp = "Ops$selfChecking".to_string();
}
),
);
App::instance().borrow_mut().add_http_handler(
"Ops$selfChecking1".to_string(),
Box::new(
move |ctx: &mut HttpContext| {
ctx.rsp = "Ops$selfChecking1".to_string();
}
),
);
}
fn update(&mut self) {
@ -28,6 +45,10 @@ impl f9::app::UserApp for UserApp {
}
fn get_http_listen_port(&self) -> i32 {
return 8080;
}
}
impl UserApp {

View File

@ -1,7 +1,7 @@
use f9::app::App;
mod app;
use crate::app::user_app::UserApp;
use crate::app::UserApp;
fn main() {
App::instance().borrow_mut().init(UserApp::instance());

2
third_party/librust vendored

@ -1 +1 @@
Subproject commit d371216ec4d299af7f7aa68d033941f8006328a1
Subproject commit 0e4b8daa3498ac0e75475b05f36d2a363098ca81