#[macro_use] extern crate diesel; #[macro_use] extern crate diesel_migrations; extern crate dotenv; use actix_web::{App, HttpServer, web}; mod db; mod handlers; mod types; #[actix_web::main] async fn main() -> std::io::Result<()> { db::run_migrations(); HttpServer::new(|| { App::new() .route( "/api/v1/schedules", web::get().to(handlers::v1::schedules::index), ) .route( "/api/v1/schedules", web::post().to(handlers::v1::schedules::add), ) .service(handlers::v1::schedules::show) .route( "/api/v1/schedules/{id}", web::delete().to(handlers::v1::schedules::delete), ) }) .bind("127.0.0.1:5000")? .run() .await }