Add a simple Tide scaffold for the agent
This commit is contained in:
parent
bb154cb92a
commit
bd33634d04
|
@ -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(())
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue