blob: 4af3f72c62857a053f556bad0022e1c168252b16 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
|
use actix_web::{web, Responder};
use mongodb::{Client, Collection};
use std::sync::Mutex;
#[path = "./db.rs"]
mod db;
pub fn export_routes(cfg: &mut web::ServiceConfig) {
cfg.service(web::resource("/hello").route(web::get().to(hello)));
}
pub async fn hello(data: web::Data<Mutex<Client>>) -> impl Responder {
let test_db: Collection<db::User> =
data.lock().unwrap().database("pressure").collection("gert");
return format!("Hello world!");
}
|