api/src/main.rs
2024-01-01 03:18:33 +01:00

29 lines
656 B
Rust

extern crate core;
mod helpers;
mod middlewares;
mod models;
mod routes;
mod schema;
use crate::helpers::db;
use actix_web::{web, App, HttpServer};
#[actix_web::main]
async fn main() -> std::io::Result<()> {
dotenvy::dotenv().expect("No .env file found");
std::env::set_var("RUST_LOG", "debug");
db::init();
HttpServer::new(move || {
App::new()
.service(web::scope("/playlists").service(routes::playlists::get_playlist))
.service(routes::auth::login)
.service(routes::me::routes())
.service(routes::users::routes())
})
.bind(("127.0.0.1", 9000))?
.run()
.await
}