Status page for GenSoc
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 

34 lines
886 B

import Express from "express";
import cookieParser from "cookie-parser";
import cors = require("cors");
import { serveDomains } from "src/lib/domains";
import statusRouter from "src/domains/status";
import landingRouter from "src/domains/landing";
const app = Express();
const STATIC_PATH = process.env.STATIC_PATH || "./static";
const PORT = process.env.PORT || 8080;
const developing = process.env.NODE_ENV === "development";
const domains = developing
? {
"gensokyo-status.local": statusRouter,
"gensokyo-landing.local": landingRouter,
}
: {
"status.gensokyo.social": statusRouter,
"gensokyo.social": landingRouter,
};
const dispatcher = serveDomains(domains);
app.use(cookieParser() as any);
app.use("/static", cors(), Express.static(STATIC_PATH));
app.use(dispatcher);
app.listen(PORT, () => {
console.log(`listening on ${PORT}`);
});