diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/api/liveops.rs | 10 | ||||
| -rw-r--r-- | src/api/mod.rs | 3 | ||||
| -rw-r--r-- | src/main.rs | 15 |
3 files changed, 26 insertions, 2 deletions
diff --git a/src/api/liveops.rs b/src/api/liveops.rs new file mode 100644 index 0000000..355103d --- /dev/null +++ b/src/api/liveops.rs @@ -0,0 +1,10 @@ +use actix_web::{get, web, Scope}; + +#[get("ping")] +async fn ping() -> &'static str { + "pong" +} + +pub fn service() -> Scope { + web::scope("liveops/").service(ping) +} diff --git a/src/api/mod.rs b/src/api/mod.rs new file mode 100644 index 0000000..f934d0e --- /dev/null +++ b/src/api/mod.rs @@ -0,0 +1,3 @@ +mod liveops; + +pub use liveops::service as liveops; diff --git a/src/main.rs b/src/main.rs index e7a11a9..ec04d93 100644 --- a/src/main.rs +++ b/src/main.rs @@ -1,3 +1,14 @@ -fn main() { - println!("Hello, world!"); +use std::time::Duration; + +use actix_web::{App, HttpServer}; + +mod api; + +#[actix_web::main] +async fn main() -> std::io::Result<()> { + HttpServer::new(|| App::new().service(api::liveops())) + .shutdown_timeout(1) + .bind(("127.0.0.1", 8080))? + .run() + .await } |
