feat(main): Bootstrap project entrypoint

This doesn't really do anything yet.
This commit is contained in:
Vincent Ambo 2018-04-08 15:49:27 +02:00
parent 72691c8d63
commit f3f509d463

26
src/main.rs Normal file
View file

@ -0,0 +1,26 @@
#[macro_use]
extern crate diesel;
extern crate chrono;
pub mod schema;
pub mod models;
use diesel::prelude::*;
use diesel::pg::PgConnection;
use std::env;
fn connect_db() -> PgConnection {
let db_url = env::var("DATABASE_URL")
.expect("DATABASE_URL must be set");
PgConnection::establish(&db_url)
.expect(&format!("Error connecting to {}", db_url))
}
fn main() {
use schema::threads::dsl::*;
use schema::posts::dsl::*;
let conn = connect_db();
let threads = threads.
}