aboutsummaryrefslogtreecommitdiff
path: root/backend/src
diff options
context:
space:
mode:
authorIlion Beyst <ilion.beyst@gmail.com>2021-12-14 20:23:07 +0100
committerIlion Beyst <ilion.beyst@gmail.com>2021-12-14 20:23:07 +0100
commit13cdbc7ff760ae91ee3f62b2a2f62c7559ccaa3c (patch)
tree500984e6b138e43e2a6fbe24ce33878bbf269f51 /backend/src
parenteabeb7ed7b641dea0b8e71ab33ab97b4ed7a4cda (diff)
downloadplanetwars.dev-13cdbc7ff760ae91ee3f62b2a2f62c7559ccaa3c.tar.xz
planetwars.dev-13cdbc7ff760ae91ee3f62b2a2f62c7559ccaa3c.zip
test registration & login
Diffstat (limited to 'backend/src')
-rw-r--r--backend/src/lib.rs35
-rw-r--r--backend/src/main.rs34
2 files changed, 38 insertions, 31 deletions
diff --git a/backend/src/lib.rs b/backend/src/lib.rs
new file mode 100644
index 0000000..0a21850
--- /dev/null
+++ b/backend/src/lib.rs
@@ -0,0 +1,35 @@
+#![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 diesel;
+
+mod db;
+mod routes;
+mod schema;
+
+#[database("postgresql_database")]
+pub struct DbConn(diesel::PgConnection);
+
+#[get("/")]
+fn index() -> &'static str {
+ "Hello, world!"
+}
+
+pub fn rocket() -> Rocket<Build> {
+ rocket::build()
+ .mount(
+ "/",
+ routes![
+ index,
+ routes::users::register,
+ routes::users::login,
+ routes::users::current_user,
+ ],
+ )
+ .attach(DbConn::fairing())
+}
diff --git a/backend/src/main.rs b/backend/src/main.rs
index 6ee54ec..65be48d 100644
--- a/backend/src/main.rs
+++ b/backend/src/main.rs
@@ -1,36 +1,8 @@
-#![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 diesel;
-
-mod db;
-mod routes;
-mod schema;
-
-#[database("postgresql_database")]
-pub struct DbConn(diesel::PgConnection);
-
-#[get("/")]
-fn index() -> &'static str {
- "Hello, world!"
-}
+extern crate mozaic4_backend;
#[launch]
-fn rocket() -> Rocket<Build> {
- rocket::build()
- .mount(
- "/",
- routes![
- index,
- routes::users::register,
- routes::users::login,
- routes::users::current_user,
- ],
- )
- .attach(DbConn::fairing())
+fn launch() -> _ {
+ mozaic4_backend::rocket()
}