-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathapp.rs
32 lines (26 loc) · 821 Bytes
/
app.rs
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
#![feature(custom_derive, plugin)]
#![plugin(tojson_macros)]
extern crate iron;
extern crate router;
extern crate rustc_serialize;
extern crate postgres;
extern crate iron_postgres_middleware as ipm;
extern crate time;
extern crate handlebars_iron as hbs;
extern crate mount;
extern crate staticfile;
#[macro_use] extern crate maplit;
use iron::prelude::*;
use middlewares::*;
mod models;
mod controllers;
mod middlewares;
const DB_ADDRESS : &'static str = "postgres://dev:dev@localhost";
const APP_ADDRESS : &'static str = "localhost:3000";
fn main() {
let mut chain = Chain::new(controllers::routes());
chain.link_before(database::register());
chain.link_after(handlebars::register());
println!("Server is running at http://{}/", APP_ADDRESS);
Iron::new(chain).http(APP_ADDRESS).unwrap();
}