Add a simple Tide scaffold for the agent

This commit is contained in:
R Tyler Croy 2023-01-28 15:10:20 -08:00
parent bb154cb92a
commit bd33634d04
No known key found for this signature in database
GPG Key ID: E5C92681BEF6CEA2
1 changed files with 31 additions and 3 deletions

View File

@ -1,4 +1,32 @@
fn main() {
println!("Janky agent!");
todo!();
use dotenv::dotenv;
use log::*;
mod routes {
use log::*;
use tide::{Body, Request, StatusCode};
/**
* GET /
*/
pub async fn index(req: Request<()>) -> Result<Body, tide::Error> {
Ok("Hello World from the Janky Agent".into())
}
}
#[async_std::main]
async fn main() -> Result<(), tide::Error> {
pretty_env_logger::init();
dotenv().ok();
let mut app = tide::new();
#[cfg(not(debug_assertions))]
{
info!("Activating RELEASE mode configuration");
app.with(driftwood::ApacheCombinedLogger);
}
debug!("Configuring routes");
app.at("/").get(routes::index);
app.listen("0.0.0.0:9000").await?;
Ok(())
}