Skip to content

Commit e1b5057

Browse files
author
David Silva
committed
remove old mongodb call
1 parent 1648e75 commit e1b5057

File tree

1 file changed

+0
-10
lines changed

1 file changed

+0
-10
lines changed

src/main.rs

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,6 @@
11
use actix_web::{get, guard, web, App, HttpResponse, HttpServer, Responder};
2-
use mongodb::{options::ClientOptions, Client};
3-
42
use dotenv::dotenv;
53
use std::env;
6-
use std::sync::*;
74

85
mod articles;
96

@@ -19,7 +16,6 @@ async fn index() -> impl Responder {
1916

2017
/**
2118
* Função main com init do http server
22-
* @todo -> Refactor main() removing old mongodb driver
2319
*/
2420

2521
#[actix_web::main]
@@ -28,15 +24,9 @@ async fn main() -> std::io::Result<()> {
2824

2925
let host = env::var("HOST").expect("HOST is not set in .env file");
3026
let port = env::var("PORT").expect("PORT is not set in .env file");
31-
32-
let database_url = env::var("DATABASE_URL").expect("DATABASE_URL is not set in .env file");
33-
let mut client_options = ClientOptions::parse(&database_url).await.unwrap();
34-
client_options.app_name = Some("blog".to_string());
35-
let client = web::Data::new(Mutex::new(Client::with_options(client_options).unwrap()));
3627

3728
HttpServer::new(move || {
3829
App::new()
39-
.app_data(client.clone())
4030
.service(index)
4131
.configure(articles::init)
4232
.default_service(

0 commit comments

Comments
 (0)