yarn build script + rocket passthrough route
This commit is contained in:
parent
67ff21d408
commit
4831a24853
@ -8,6 +8,11 @@ fn index() -> Result<NamedFile, ()> {
|
|||||||
NamedFile::open("static/index.html").map_err(|_| ())
|
NamedFile::open("static/index.html").map_err(|_| ())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[get("/bundle.js")]
|
||||||
|
fn js_bundle() -> Result<NamedFile, ()> {
|
||||||
|
NamedFile::open("static/bundle.js").map_err(|_| ())
|
||||||
|
}
|
||||||
|
|
||||||
#[derive(Serialize, Deserialize)]
|
#[derive(Serialize, Deserialize)]
|
||||||
struct Input {
|
struct Input {
|
||||||
source: String,
|
source: String,
|
||||||
@ -25,5 +30,5 @@ fn interpreter_input(input: Json<Input>) -> Json<Output> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
pub fn web_main() {
|
pub fn web_main() {
|
||||||
rocket::ignite().mount("/", routes![index, interpreter_input]).launch();
|
rocket::ignite().mount("/", routes![index, js_bundle, interpreter_input]).launch();
|
||||||
}
|
}
|
||||||
|
@ -1,5 +1,10 @@
|
|||||||
const React = require("react");
|
const React = require("react");
|
||||||
const ReactDOM = require("react-dom");
|
const ReactDOM = require("react-dom");
|
||||||
|
|
||||||
const main = document.getElementById("main");
|
const main = (<div>
|
||||||
ReactDOM.render(<h1>Schala web input</h1>, main);
|
<h1>Schala web input</h1>
|
||||||
|
<p>Write your source code here</p>
|
||||||
|
</div>);
|
||||||
|
|
||||||
|
const rootDom = document.getElementById("main");
|
||||||
|
ReactDOM.render(<h1>Schala web input</h1>, rootDom);
|
||||||
|
@ -14,5 +14,8 @@
|
|||||||
},
|
},
|
||||||
"babel": {
|
"babel": {
|
||||||
"presets": ["babel-preset-react", "babel-preset-es2015"]
|
"presets": ["babel-preset-react", "babel-preset-es2015"]
|
||||||
|
},
|
||||||
|
"scripts": {
|
||||||
|
"build": "browserify main.jsx -t babelify -o bundle.js"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user