2021-12-13 15:43:47 +01:00
|
|
|
#![feature(proc_macro_hygiene, decl_macro)]
|
|
|
|
|
2021-12-13 22:41:20 +01:00
|
|
|
use rocket::{Build, Rocket};
|
|
|
|
use rocket_sync_db_pools::database;
|
|
|
|
|
2021-12-13 15:43:47 +01:00
|
|
|
#[macro_use]
|
|
|
|
extern crate rocket;
|
|
|
|
#[macro_use]
|
2021-12-13 22:41:20 +01:00
|
|
|
extern crate diesel;
|
|
|
|
|
|
|
|
mod db;
|
|
|
|
mod routes;
|
|
|
|
mod schema;
|
|
|
|
|
|
|
|
#[database("postgresql_database")]
|
|
|
|
pub struct DbConn(diesel::PgConnection);
|
2021-12-13 15:43:47 +01:00
|
|
|
|
|
|
|
#[get("/")]
|
|
|
|
fn index() -> &'static str {
|
|
|
|
"Hello, world!"
|
|
|
|
}
|
|
|
|
|
2021-12-13 22:41:20 +01:00
|
|
|
#[launch]
|
|
|
|
fn rocket() -> Rocket<Build> {
|
|
|
|
rocket::build()
|
|
|
|
.mount(
|
|
|
|
"/",
|
|
|
|
routes![
|
|
|
|
index,
|
|
|
|
routes::users::register,
|
|
|
|
routes::users::login,
|
|
|
|
routes::users::current_user,
|
|
|
|
],
|
|
|
|
)
|
|
|
|
.attach(DbConn::fairing())
|
2021-12-13 15:43:47 +01:00
|
|
|
}
|