summaryrefslogtreecommitdiff
path: root/source/index.ts
blob: 209e8c8d2c1cf1bb51892b46c7c82d454efb8ef3 (plain)
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
// 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"))