-
Notifications
You must be signed in to change notification settings - Fork 125
/
Copy pathindex.js
37 lines (28 loc) · 837 Bytes
/
index.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
import { ChemicalServer } from "chemicaljs";
import express from "express";
import path from "path";
const [app, listen] = new ChemicalServer({
uv: true,
scramjet: false,
rammerhead: false,
});
const port = process.env.PORT || 8080;
const __dirname = process.cwd();
app.use(express.static("static"));
app.set("view engine", "ejs");
app.set("views", path.join(__dirname, "files"));
app.get("/", (req, res) => {
res.render("index");
})
app.get("/~", (req, res) => {
res.render("proxy");
});
app.serveChemical();
app.use((req, res) => {
res.status(404);
res.render("404", {error_title: "404 | Page Not Found", error: `We couldn't find the page you were looking for.`})
});
listen(port, () => {
console.log(`KCC is listening on port ${port}!`);
console.log(`\t1. http://localhost:${port}`);
});