diff options
Diffstat (limited to 'api/src/routes.rs')
-rw-r--r-- | api/src/routes.rs | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/api/src/routes.rs b/api/src/routes.rs new file mode 100644 index 0000000..4af3f72 --- /dev/null +++ b/api/src/routes.rs @@ -0,0 +1,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!"); +} |