mirror of
https://github.com/stefanpejcic/openpanel
synced 2025-06-26 18:28:26 +00:00
19 lines
464 B
TypeScript
19 lines
464 B
TypeScript
import express from "express";
|
|
import path from "path";
|
|
|
|
import type { Express } from "express";
|
|
|
|
export const serveClient = (app: Express) => {
|
|
app.use(express.static(path.join(__dirname, "client")));
|
|
|
|
app.use((req, res, next) => {
|
|
if (req.path.startsWith("/api")) {
|
|
return next();
|
|
}
|
|
if (req.path.startsWith("/open-in-editor")) {
|
|
return next();
|
|
}
|
|
res.status(200).sendFile(path.join(`${__dirname}/client/index.html`));
|
|
});
|
|
};
|