dockge/backend/routers/main-router.ts

24 lines
673 B
TypeScript
Raw Normal View History

2023-10-23 11:30:58 +00:00
import { DockgeServer } from "../dockgeServer";
import { Router } from "../router";
import express, { Express, Router as ExpressRouter } from "express";
export class MainRouter extends Router {
create(app: Express, server: DockgeServer): ExpressRouter {
const router = express.Router();
router.get("/", (req, res) => {
2023-10-26 05:23:45 +00:00
res.send(server.indexHTML);
2023-10-23 11:30:58 +00:00
});
2023-11-05 17:18:02 +00:00
// Robots.txt
router.get("/robots.txt", async (_request, response) => {
let txt = "User-agent: *\nDisallow: /";
response.setHeader("Content-Type", "text/plain");
response.send(txt);
});
2023-10-23 11:30:58 +00:00
return router;
}
}