planetwars.dev/backend/src/main.rs

37 lines
678 B
Rust
Raw Normal View History

2021-12-13 15:43:47 +01:00
#![feature(proc_macro_hygiene, decl_macro)]
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]
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!"
}
#[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
}