-
Notifications
You must be signed in to change notification settings - Fork 0
/
GeckoServer.js
30 lines (27 loc) · 979 Bytes
/
GeckoServer.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
// Generated by CoffeeScript 1.6.3
var page, webserverTest;
page = require("webpage").create();
webserverTest = require("webserver").create();
webserverTest.listen(8083, function(request, response) {
if (request.url === "/ping.html") {
response.statusCode = 200;
response.write("slimerjs server is listening\n");
return response.close();
} else {
return page.open("../local-copies/html-converted/" + request.queryString + "/" + request.queryString + ".html").then(function(status) {
if (status === "success") {
console.log(request.queryString);
console.log(request.path);
response.statusCode = 200;
response.write("page loaded by slimerjs");
response.close();
} else {
response.statusCode = 500;
response.write("page could not be found by slimerjs");
response.close();
console.log("page could not be found by slimerjs");
}
return page.close();
});
}
});