-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathindex.js
26 lines (20 loc) · 900 Bytes
/
index.js
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
import fs from "fs";
import path from "path";
import express from "express";
import swaggerUi from "swagger-ui-express";
import YAML from "yaml";
const router = express.Router();
import { config } from "@packages/common";
import apiRouter from "./api/index.js";
import { handler as astroHandler } from "@packages/astro";
import send from "send";
const swaggerDoc = YAML.parse(fs.readFileSync(path.join(import.meta.dirname, "../", "docs", "openapi.yml"), "utf8"));
router.use("/api-doc", swaggerUi.serve, swaggerUi.setup(swaggerDoc));
router.use("/api", apiRouter);
router.get('/webupload', function (req, res) {
res.status(200).send('HELLO')
})
router.use(express.static(path.resolve(import.meta.dirname, "../", config.filesDir)));
router.use("/", express.static(path.join(import.meta.dirname, "../", "packages", "astro", "dist", "client")));
router.use(astroHandler);
export default router