mirror of
https://github.com/Infisical/infisical.git
synced 2025-03-31 22:09:57 +00:00
feat: add custom server
This commit is contained in:
@ -87,6 +87,10 @@ import { setup } from "./utils/setup";
|
||||
import { syncSecretsToThirdPartyServices } from "./queues/integrations/syncSecretsToThirdPartyServices";
|
||||
import { githubPushEventSecretScan } from "./queues/secret-scanning/githubScanPushEvent";
|
||||
const SmeeClient = require("smee-client"); // eslint-disable-line
|
||||
import path from "path";
|
||||
import next from "next";
|
||||
|
||||
const dir = path.join(__dirname, "../../frontend");
|
||||
|
||||
const main = async () => {
|
||||
await setup();
|
||||
@ -209,6 +213,19 @@ const main = async () => {
|
||||
// server status
|
||||
app.use("/api", healthCheck);
|
||||
|
||||
if (process.env.NODE_ENV === "production") {
|
||||
const nextApp = next({
|
||||
dev: false,
|
||||
dir
|
||||
});
|
||||
const nextHandler = nextApp.getRequestHandler();
|
||||
await nextApp.prepare();
|
||||
|
||||
app.all("*", (req, res) => {
|
||||
return nextHandler(req, res);
|
||||
});
|
||||
}
|
||||
|
||||
//* Handle unrouted requests and respond with proper error message as well as status code
|
||||
app.use((req, res, next) => {
|
||||
if (res.headersSent) return next();
|
||||
|
Reference in New Issue
Block a user