hrms-report-template/app.ts

29 lines
1.4 KiB
TypeScript
Raw Normal View History

/*
* Report Server
* Web API Path
* Node.js reverse proxy pandoc swan
* demo frontent public
*/
2023-10-08 18:29:28 +07:00
import cors from "cors"
import swaggerspecs from "./libs/swagger-specs.json"
import swaggerUi from "swagger-ui-express"
import express, { Express, Request, Response } from 'express'
import { docxTemplateRoute } from './libs/docx-templates-lib'
import { xlsxTemplateRoute } from './libs/xlsx-template-lib'
import { convertTemplateRoute } from './libs/convert-libs'
const app: Express = express()
const port: number = Number(process.env.PORT) || 80;
2023-10-08 18:29:28 +07:00
app.use(cors());
2024-04-20 11:20:34 +07:00
app.use(express.json({ limit: "200mb" })); //application/json
app.use(express.raw({ limit: "200mb" })); //application/octet-stream
2024-04-20 11:20:34 +07:00
app.use(express.urlencoded({ extended: true, limit: "200mb" }));
app.use("/swagger", swaggerUi.serve, swaggerUi.setup(swaggerspecs,{ explorer: true }));
app.get('/', (req: Request, res: Response) => {
res.json({
message: 'Hello report-template API !!',
})
})
app.use('/api/v1/report-template/docx', docxTemplateRoute);
app.use('/api/v1/report-template/xlsx', xlsxTemplateRoute);
app.use('/api/v1/report-template/convert', convertTemplateRoute);
app.listen(port, () => console.log(`Application is running on port ${port}`))