aboutsummaryrefslogtreecommitdiff
path: root/src/main.rs
diff options
context:
space:
mode:
authorKevin J Hoerr <kjhoerr@submelon.tech>2019-10-30 13:14:09 -0400
committerKevin J Hoerr <kjhoerr@submelon.tech>2019-10-30 13:14:09 -0400
commit82c3cc2c1952020ef13c330047cbc8ba1dc7cc75 (patch)
treef8b4a170228bc10677f4c928246823988ff9be19 /src/main.rs
parentd133f7a23aa758c7ecd65c9e32c711e8475d0e06 (diff)
downloadaugust-offensive-82c3cc2c1952020ef13c330047cbc8ba1dc7cc75.tar.gz
august-offensive-82c3cc2c1952020ef13c330047cbc8ba1dc7cc75.tar.bz2
august-offensive-82c3cc2c1952020ef13c330047cbc8ba1dc7cc75.zip
Refactor routes and scope into routes module
Diffstat (limited to 'src/main.rs')
-rw-r--r--src/main.rs12
1 files changed, 5 insertions, 7 deletions
diff --git a/src/main.rs b/src/main.rs
index 1b5ac70..b5bab39 100644
--- a/src/main.rs
+++ b/src/main.rs
@@ -14,11 +14,10 @@ pub mod messages;
pub mod routes;
pub mod schema;
-use actix_web::{middleware, web::route, web::scope, App, HttpServer};
+use actix_web::{middleware, App, HttpServer};
use diesel::pg::PgConnection;
use diesel::prelude::*;
use dotenv::dotenv;
-use routes::*;
use std::{env, io::Error};
fn main() {
@@ -29,6 +28,7 @@ fn main() {
}
}
+// Run start-up for the server and dependencies
fn run() -> Result<(), Error> {
dotenv().ok();
let db_url = env::var("DATABASE_URL").expect("DATABASE_URL must be set");
@@ -40,11 +40,9 @@ fn run() -> Result<(), Error> {
PgConnection::establish(&db_url).expect(&format!("Error connecting to {}", db_url));
HttpServer::new(|| {
- App::new().wrap(middleware::Logger::default()).service(
- scope("/api")
- .service(scope("/callback").default_service(route().to(callback)))
- .default_service(route().to(not_understood)),
- )
+ App::new()
+ .wrap(middleware::Logger::default())
+ .service(routes::get_scope())
})
.bind(&bind_address)?
.start();