blob: 0a21850b46cef11552b79cb5778f472a27490224 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
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())
}
|