mirror of
https://github.com/guilhermewerner/rust-api
synced 2025-06-16 06:55:03 +00:00
Change to Actix Web
This commit is contained in:
25
Source/Backend.rs
Normal file
25
Source/Backend.rs
Normal file
@ -0,0 +1,25 @@
|
||||
#![allow(non_snake_case)]
|
||||
|
||||
mod Controllers;
|
||||
|
||||
use actix_web::{middleware, App, HttpServer};
|
||||
use std::env;
|
||||
use std::io::Result;
|
||||
|
||||
use Controllers::Hello;
|
||||
|
||||
pub async fn Main() -> Result<()> {
|
||||
env::set_var("FRAMEWORK_LOG_LEVEL", "debug");
|
||||
|
||||
Framework_Log::Init();
|
||||
|
||||
HttpServer::new(|| {
|
||||
App::new()
|
||||
.wrap(middleware::Logger::default())
|
||||
.wrap(middleware::Compress::default())
|
||||
.service(Hello::Index)
|
||||
})
|
||||
.bind("localhost:5000")?
|
||||
.run()
|
||||
.await
|
||||
}
|
Reference in New Issue
Block a user