55 lines
1.3 KiB
Rust
55 lines
1.3 KiB
Rust
#![feature(proc_macro_hygiene, decl_macro)]
|
|
|
|
extern crate config;
|
|
extern crate serde;
|
|
#[macro_use]
|
|
extern crate serde_derive;
|
|
#[macro_use]
|
|
extern crate log;
|
|
extern crate lazy_static;
|
|
#[macro_use]
|
|
extern crate rocket;
|
|
#[macro_use]
|
|
extern crate diesel;
|
|
|
|
pub mod database;
|
|
pub mod helper;
|
|
pub mod modules;
|
|
pub mod schema;
|
|
|
|
use crate::database::controller::connector::establish_connection;
|
|
use crate::database::model::entities::Entity;
|
|
use diesel::query_dsl::filter_dsl::FilterDsl;
|
|
use diesel::RunQueryDsl;
|
|
use helper::settings::Settings;
|
|
use rocket::State;
|
|
|
|
fn main() {
|
|
env_logger::init(); //Initializes logger. Set environment variable RUST_LOG=debug|info|warn|error to set loglevel
|
|
|
|
let settings = match Settings::new() {
|
|
Ok(settings) => settings,
|
|
Err(e) => {
|
|
error!("Failed to read config: {}", e);
|
|
std::process::exit(1);
|
|
}
|
|
};
|
|
|
|
debug!(
|
|
"Hello, world! Default Language: {}",
|
|
settings.application.default_language
|
|
);
|
|
|
|
let rocket = rocket::ignite().manage(settings);
|
|
|
|
/*
|
|
let state = State::from(&rocket).unwrap();
|
|
let con = establish_connection(state);
|
|
use schema::entities::dsl::*;
|
|
let result = entities.load::<Entity>(&con).expect("Error!");
|
|
|
|
for item in result {
|
|
println!("{}", item.entity_id);
|
|
}*/
|
|
}
|