From 2e0a6909cbfb2479edd7fba78fa4d0135a79ae3f Mon Sep 17 00:00:00 2001 From: Benedict Börger Date: Sat, 23 Mar 2019 15:40:35 +0100 Subject: [global] refactoring code base --- src/main.rs | 46 ++++++++++++++++++++++++++-------------------- 1 file changed, 26 insertions(+), 20 deletions(-) (limited to 'src/main.rs') diff --git a/src/main.rs b/src/main.rs index 4c0768c..1325742 100644 --- a/src/main.rs +++ b/src/main.rs @@ -1,23 +1,29 @@ -mod exchange; -mod Csv; -//use exchange::Stock; -use Csv::CsvFile; +#![feature(proc_macro_hygiene,decl_macro)] +#[macro_use] +extern crate rocket; +extern crate rocket_contrib; +extern crate regex; +extern crate chrono; -fn main() { - println!("Welcome to your investment calculator!"); +#[macro_use] +extern crate serde_derive; + +//mod exchange; +mod parsers; +mod banking; +mod web_frontend; - // TODO Compute how the money would have benn developed on historical data - //Stock::read_from_csv_file("~/hih"); - let config = CsvFile::read_file("test.csv", ";", true); - let config = match config { - Ok(c) => c, - Err(error) => panic!("Error reading CSV file: {}", error), - }; - let mut i = 0; - for line in config.content { - i += 1; - for f in line { - println!("{}: {}",i, f) - } - } +use rocket_contrib::templates::Template; + +fn main() { + // handle command line parameters + // e.g. wheres is the asset config ini file + // TODO how pass config to the modules/handler ? + // launch web frontend + rocket::ignite() + .attach(Template::fairing()) + .mount("/", routes![web_frontend::account_handler, web_frontend::transactions::transaction_handler, + web_frontend::transactions::transaction_handler_post, + web_frontend::balance::balance_handler, web_frontend::static_handler]) + .launch(); } -- cgit v1.2.3-70-g09d2