From 246851e85c3ac1d62853ee7622ad86549aaf40e2 Mon Sep 17 00:00:00 2001 From: lonkaars Date: Wed, 18 Aug 2021 11:35:41 +0200 Subject: more api but brokey --- api/src/routes.rs | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100644 api/src/routes.rs (limited to 'api/src/routes.rs') 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>) -> impl Responder { + let test_db: Collection = + data.lock().unwrap().database("pressure").collection("gert"); + + return format!("Hello world!"); +} -- cgit v1.2.3