diff options
Diffstat (limited to 'source/index.ts')
-rw-r--r-- | source/index.ts | 32 |
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")) + |