-
Notifications
You must be signed in to change notification settings - Fork 2
/
app.js
44 lines (33 loc) · 900 Bytes
/
app.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
const express = require("express");
const app = express();
/**/
// support template engine
app.set("view engine", "pug");
app.set("views", "views");
// static files
app.use(express.static("public"));
app.use("/node_modules", express.static("node_modules"));
/**/
const fs = require("fs");
var bootables = JSON.parse(
fs.readFileSync("public/emulator.json")
);
/**/
app.get("/", (request, response) => {
response.render("index", {
monaco_theme: request.query.monaco_theme,
bootables: bootables
});
});
app.get("/show", (request, response) => {
response.render("show", {
monaco_theme: request.query.monaco_theme,
bootable_name: request.query.bootable_name,
bootable: JSON.stringify(
bootables[request.query.bootable_name]
)
});
});
app.listen(8080, "0.0.0.0", () => {
console.log("http://0.0.0.0:8080");
});