-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathlaunch.html
More file actions
70 lines (63 loc) · 1.68 KB
/
Copy pathlaunch.html
File metadata and controls
70 lines (63 loc) · 1.68 KB
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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>MemePI</title>
<link rel="stylesheet" type="text/css" href="shoelace.css">
<link rel="stylesheet" type="text/css" href="https://maxcdn.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css">
<link rel="stylesheet" type="text/css" href="support.css">
</head>
<body>
<script>
var {rest} = require("./launch_rest")
var running = false
function server() {
console.log("Click");
var json = document.getElementById('json').value
var port = document.getElementById('port').value
var serving = document.getElementById('serving')
//
if (port.length < 1) {
serving.innerHTML = "One or more of your fields are empty"
}
else if (running) {
serving.innerHTML = `Server is already running! (http://localhost:${port})`
}
else {
serving.innerHTML = `Serving at http://localhost:${port}`
running = true
try {rest(json, port)}
catch (err) {
serving.innerHTML = `Port ${port} is in use`
}
}
}
</script>
<div class="row">
<div class="col-10 offset-1">
<h1>Launch <i class="fa fa-rocket"></i></h1>
<p>Close window to stop running server</p>
</div>
</div>
<div class="row">
<div class="col-10 offset-1">
<div class="alert" id="serving">Server not running</div>
</div>
</div>
<div class="row">
<div class="col-10 offset-1">
<textarea id="json">
{example: "JSON"}</textarea>
</div>
</div>
<br>
<div class="row">
<div class="col-10 offset-1">
<div class="input-group">
<input type="text" id="port" placeholder="port">
<button type="button" class="button" onclick="server()">Serve</button>
</div>
</div>
</div>
</body>
</html>