-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #9 from takejohn/feature/8-astro-page
Astroを使って高速化 (#8)
- Loading branch information
Showing
24 changed files
with
7,333 additions
and
266 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,30 +1,26 @@ | ||
const fs = require("fs"); | ||
const path = require("path"); | ||
const express = require("express"); | ||
const swaggerUi = require("swagger-ui-express"); | ||
const YAML = require("yaml"); | ||
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(); | ||
const config = require("../config.js"); | ||
const send = require("send"); | ||
const filesDir = path.resolve(__dirname, "../", config.filesDir); | ||
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(__dirname, "../", "docs", "openapi.yml"), "utf8")); | ||
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", require("./api")) | ||
router.use("/api", apiRouter); | ||
|
||
router.get('/webupload', function (req, res) { | ||
res.status(200).send('HELLO') | ||
}) | ||
|
||
router.use(express.static(path.join(__dirname, "../", "files"))) | ||
router.use(express.static(path.resolve(import.meta.dirname, "../", config.filesDir))); | ||
|
||
router.use("/static", express.static(path.join(__dirname, "../", "html"))) | ||
router.use("/", express.static(path.join(import.meta.dirname, "../", "packages", "astro", "dist", "client"))); | ||
router.use(astroHandler); | ||
|
||
|
||
router.use((req, res, next) => { | ||
if (req.method != "GET") return next(); | ||
res.send(fs.readFileSync(path.join(__dirname, "../", "html", "index.html"), "utf8")) | ||
}) | ||
|
||
module.exports = router | ||
export default router |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.