mirror of
https://github.com/mermaid-js/mermaid.git
synced 2025-01-14 06:43:25 +08:00
328f3968d1
* release/9.4.2: 9.4.2 Fix mindmap demo 9.4.2-rc.2 chore: Rename diagram-definitions with specific names Use cytoscape esm Revert "chore: Defer elk loading" Revert "Split cytoscape" test(gantt): test daylight savings in ganttdb refactor(deps): replace `moment` with `dayjs` fix(E2E): Add cors package fix Server Fix lockfile Remove Readme
29 lines
803 B
TypeScript
29 lines
803 B
TypeScript
import express from 'express';
|
|
import cors from 'cors';
|
|
import { createServer as createViteServer } from 'vite';
|
|
|
|
async function createServer() {
|
|
const app = express();
|
|
|
|
// Create Vite server in middleware mode
|
|
const vite = await createViteServer({
|
|
configFile: './vite.config.ts',
|
|
mode: 'production',
|
|
server: { middlewareMode: true },
|
|
appType: 'custom', // don't include Vite's default HTML handling middleware
|
|
});
|
|
|
|
app.use(cors());
|
|
app.use(express.static('./packages/mermaid/dist'));
|
|
app.use(express.static('./packages/mermaid-example-diagram/dist'));
|
|
app.use(vite.middlewares);
|
|
app.use(express.static('demos'));
|
|
app.use(express.static('cypress/platform'));
|
|
|
|
app.listen(9000, () => {
|
|
console.log(`Listening on http://localhost:9000`);
|
|
});
|
|
}
|
|
|
|
createServer();
|