blob: 6ee54ec4e21abb9ea44c0166474f21eb4586292c (
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
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 diesel;
mod db;
mod routes;
mod schema;
#[database("postgresql_database")]
pub struct DbConn(diesel::PgConnection);
#[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())
}
|