Compare commits
2 Commits
bb154cb92a
...
59c01e0e34
Author | SHA1 | Date |
---|---|---|
R Tyler Croy | 59c01e0e34 | |
R Tyler Croy | bd33634d04 |
|
@ -1,4 +1,32 @@
|
|||
fn main() {
|
||||
println!("Janky agent!");
|
||||
todo!();
|
||||
use dotenv::dotenv;
|
||||
use log::*;
|
||||
|
||||
mod routes {
|
||||
|
||||
use tide::{Body, Request};
|
||||
|
||||
/**
|
||||
* 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(())
|
||||
}
|
||||
|
|
|
@ -20,7 +20,7 @@ pub struct AppState<'a> {
|
|||
impl AppState<'_> {
|
||||
fn new(db: SqlitePool) -> Self {
|
||||
Self {
|
||||
db: db,
|
||||
db,
|
||||
hb: Arc::new(RwLock::new(Handlebars::new())),
|
||||
}
|
||||
}
|
||||
|
@ -58,10 +58,10 @@ impl AppState<'_> {
|
|||
*/
|
||||
mod routes {
|
||||
use crate::AppState;
|
||||
use log::*;
|
||||
use std::collections::HashMap;
|
||||
use tide::{Body, Request, StatusCode};
|
||||
use uuid::Uuid;
|
||||
|
||||
|
||||
use tide::{Body, Request};
|
||||
|
||||
|
||||
/**
|
||||
* GET /
|
||||
|
@ -76,10 +76,10 @@ mod routes {
|
|||
}
|
||||
|
||||
pub mod api {
|
||||
use log::*;
|
||||
use tide::{Body, Request, Response, StatusCode};
|
||||
|
||||
|
||||
|
||||
use crate::AppState;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue