29 lines
887 B
TypeScript
29 lines
887 B
TypeScript
import "reflect-metadata";
|
|
import express from "express";
|
|
import {
|
|
answerPing,
|
|
createConfigurationHandler,
|
|
} from "./handlers/appStatus.js";
|
|
import { Container } from "typedi";
|
|
import { createCurrentHandler } from "./handlers/current.js";
|
|
import path from "path";
|
|
import { apiRouter } from "./handlers/api.js";
|
|
import { AppConfig, __dirname } from "./util/Configuration.js";
|
|
import favicon from "serve-favicon";
|
|
|
|
const app = express();
|
|
const config = Container.get(AppConfig);
|
|
const port = config.getConfiguration().listenPort;
|
|
|
|
app.use(favicon(path.join(__dirname, "public", "favicon.png")));
|
|
app.get("/ping", answerPing);
|
|
app.get("/config", createConfigurationHandler());
|
|
app.get("/current", createCurrentHandler());
|
|
app.use("/api", apiRouter);
|
|
|
|
app.use(express.static(path.join(__dirname, "public")));
|
|
|
|
app.listen(port, () => {
|
|
console.log(`App listening on port ${port}`);
|
|
});
|