diff options
author | lonkaars <loek@pipeframe.xyz> | 2021-08-18 11:35:41 +0200 |
---|---|---|
committer | lonkaars <loek@pipeframe.xyz> | 2021-08-18 11:35:41 +0200 |
commit | 246851e85c3ac1d62853ee7622ad86549aaf40e2 (patch) | |
tree | 7c138e9c9102a6a5bd1dc9799dfb180415c42c24 /api/src/routes.rs | |
parent | 36a263aee35a819e90bb9430a70d0e5ba321ba63 (diff) |
more api but brokey
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!"); +} |