import express from "express"; import { graphMiddleware } from "./ExampleOutput/Middleware"; import { join } from "path"; import { charactersMiddleware } from "./TestOutput/CharactersMiddleware"; import * as swaggerUi from "swagger-ui-express"; import * as swaggerDocument from "./ExampleOutput/openapi.json"; import * as swaggerDocumentTest from "./TestOutput/openapi.json"; import bodyParser from "body-parser"; const port = 8080; const webRoot = "/"; const INDEX_ROUTE = "index"; const app = express(); app.disable("x-powered-by"); app.use(bodyParser.json()); app.use(graphMiddleware({ fileName: join(__dirname, "..", "src", "ExampleOutput", "graph.json") })) app.use(charactersMiddleware({ fileName: join(__dirname, "..", "src", "TestOutput", "characters.json") })) app.use('/api-docs', swaggerUi.serve, swaggerUi.setup(swaggerDocument)); app.use('/api-docs-test', swaggerUi.serve, swaggerUi.setup(swaggerDocumentTest)); app.get(`${webRoot}${INDEX_ROUTE}`, (req, res) => { res.send("Hello there :-)"); }); // should be one of the last routes: // app.use(express.static(join(__dirname, "..", "..", "client", "static"))); app.listen(port, () => console.log(`ServerGenerator running on port ${port}...`));