Add sms.aspx route

This commit is contained in:
DefectingCat
2023-04-14 21:44:10 +08:00
parent b3db0c3c3d
commit a7bf4393cd
4 changed files with 9 additions and 3 deletions

0
src/consts.rs Normal file
View File

View File

@ -1,10 +1,11 @@
use std::{net::SocketAddr, process::exit, sync::Arc};
use anyhow::Result;
use axum::{routing::get, Router, Server};
use log::{error, info};
use tokio::sync::Mutex;
use crate::config::Config;
use crate::{config::Config, routes::messages::get_sms_aspx};
mod arg;
mod config;
@ -28,7 +29,10 @@ async fn main() -> Result<()> {
error!("Failed to read port from config, using default port 3000");
3000
};
let app = axum::Router::new();
// Define routes
let message_routes = Router::new().route("/sms.aspx", get(get_sms_aspx));
let app = Router::new().merge(message_routes);
info!("Server starting");
let addr: SocketAddr = match format!("0.0.0.0:{port:?}").parse() {
@ -38,7 +42,7 @@ async fn main() -> Result<()> {
exit(1);
}
};
match axum::Server::bind(&addr)
match Server::bind(&addr)
.serve(app.into_make_service())
.with_graceful_shutdown(shutdown_signal())
.await

1
src/routes/messages.rs Normal file
View File

@ -0,0 +1 @@
pub async fn get_sms_aspx() {}

View File

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