aboutsummaryrefslogtreecommitdiff
path: root/backend/src/main.rs
diff options
context:
space:
mode:
authorIlion Beyst <ilion.beyst@gmail.com>2021-12-13 22:41:20 +0100
committerIlion Beyst <ilion.beyst@gmail.com>2021-12-13 22:41:20 +0100
commiteabeb7ed7b641dea0b8e71ab33ab97b4ed7a4cda (patch)
tree9cd2f38290fa059020feb049d8a2e2e91adac68b /backend/src/main.rs
parent8b4440f7236b0972c1a804eea4c8305b958ad03c (diff)
downloadplanetwars.dev-eabeb7ed7b641dea0b8e71ab33ab97b4ed7a4cda.tar.xz
planetwars.dev-eabeb7ed7b641dea0b8e71ab33ab97b4ed7a4cda.zip
start implementing basic login functionality
Diffstat (limited to 'backend/src/main.rs')
-rw-r--r--backend/src/main.rs27
1 files changed, 24 insertions, 3 deletions
diff --git a/backend/src/main.rs b/backend/src/main.rs
index fd0ff2e..6ee54ec 100644
--- a/backend/src/main.rs
+++ b/backend/src/main.rs
@@ -1,15 +1,36 @@
#![feature(proc_macro_hygiene, decl_macro)]
+use rocket::{Build, Rocket};
+use rocket_sync_db_pools::database;
+
#[macro_use]
extern crate rocket;
#[macro_use]
-extern crate rocket_contrib;
+extern crate diesel;
+
+mod db;
+mod routes;
+mod schema;
+
+#[database("postgresql_database")]
+pub struct DbConn(diesel::PgConnection);
#[get("/")]
fn index() -> &'static str {
"Hello, world!"
}
-fn main() {
- rocket::ignite().mount("/", routes![index]).launch();
+#[launch]
+fn rocket() -> Rocket<Build> {
+ rocket::build()
+ .mount(
+ "/",
+ routes![
+ index,
+ routes::users::register,
+ routes::users::login,
+ routes::users::current_user,
+ ],
+ )
+ .attach(DbConn::fairing())
}