From 7430aebe63cc2e000f6385f19c3198dc16fc717e Mon Sep 17 00:00:00 2001 From: greg Date: Mon, 2 Oct 2017 00:15:39 -0700 Subject: [PATCH] Webapp actually does something --- src/webapp.rs | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/webapp.rs b/src/webapp.rs index 5538ddd..f6e850b 100644 --- a/src/webapp.rs +++ b/src/webapp.rs @@ -1,7 +1,8 @@ use rocket; - use rocket::response::NamedFile; use rocket_contrib::Json; +use schala_lang; +use language::{ProgrammingLanguageInterface, EvalOptions}; #[get("/")] fn index() -> Result { @@ -25,9 +26,9 @@ struct Output { #[post("/input", format = "application/json", data = "")] fn interpreter_input(input: Json) -> Json { - println!("INPUT {:?}", input); - let output = Output { text: "test interpreter output".to_string() }; - Json(output) + let mut schala = schala_lang::Schala::new(); + let code_output = schala.evaluate_in_repl(&input.source, &EvalOptions::default()); + Json(Output { text: code_output.to_string() }) } pub fn web_main() {