summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormetamuffin <metamuffin@yandex.com>2021-09-14 20:09:15 +0200
committermetamuffin <metamuffin@yandex.com>2021-09-14 20:09:15 +0200
commit5c7cd8f1322f6d3288be04daf5b4186ecc5e7460 (patch)
tree6ff2e3930320d584e30780fff01aa79cefc09b7d
downloadmetamuffin-website-5c7cd8f1322f6d3288be04daf5b4186ecc5e7460.tar
metamuffin-website-5c7cd8f1322f6d3288be04daf5b4186ecc5e7460.tar.bz2
metamuffin-website-5c7cd8f1322f6d3288be04daf5b4186ecc5e7460.tar.zst
a
-rw-r--r--source/index.ts32
1 files changed, 32 insertions, 0 deletions
diff --git a/source/index.ts b/source/index.ts
new file mode 100644
index 0000000..209e8c8
--- /dev/null
+++ b/source/index.ts
@@ -0,0 +1,32 @@
+// SPDX-License-Identifier: AGPL-3.0-only
+
+import express from "express"
+import { readFileSync } from "fs"
+import { readFile } from "fs/promises"
+import { join } from "path/posix"
+import pug from "pug"
+
+const app = express()
+
+const render_env = {
+ commit: readFileSync()
+}
+
+app.set("view engine", "pug")
+app.set("views", join(__dirname, "../views"))
+
+app.get("/", (req, res) => {
+ res.render("index", render_env)
+})
+app.get("/licence", async (req, res) => {
+ const content = (await readFile(join(__dirname, "../LICENCE"))).toString()
+ res.type("text/plain").send(content)
+})
+
+
+
+const PORT = parseInt(process.env.PORT ?? "8080")
+const HOST = process.env.HOST || "127.0.0.1"
+
+app.listen(PORT, HOST, () => console.log("aaaaa"))
+