BinghamtonBetterBus/src/main.rs

32 lines
841 B
Rust

extern crate tokio;
extern crate reqwest;
extern crate tide;
extern crate anyhow;
extern crate sea_orm;
mod state;
use tide::prelude::*;
#[tokio::main]
async fn main() -> anyhow::Result<()> {
let mut app = tide::with_state(state::State::new().await?);
app.at("/path").get(transit_path);
app.at("/time-to-arrive").get(transit_estimate);
// TODO: change to 0.0.0.0 when docker image done
app.listen("127.0.0.1:8080").await?;
Ok(())
}
/// return the best path with the request specifying ISO time, lat and longitude in query params
async fn transit_path(mut req: tide::Request<state::State>)->tide::Result{
Ok("".into())
}
/// return the num of estimated seconds for bus id and stop ids given in query params
async fn transit_estimate(mut req: tide::Request<state::State>)->tide::Result{
Ok("".into())
}