replaced backend with vite
This commit is contained in:
@@ -1,4 +1,17 @@
|
||||
import "@stirling-pdf/shared-operations/src/i18next.config";
|
||||
import i18next from "i18next";
|
||||
import resourcesToBackend from "i18next-resources-to-backend";
|
||||
|
||||
i18next.use(resourcesToBackend((language: string, namespace: string) => import(`../../shared-operations/public/locales/${namespace}/${language}.json`)))
|
||||
.init({
|
||||
debug: true,
|
||||
ns: ["common"], // Preload this namespace, no need to add the others, they will load once their module is loaded
|
||||
defaultNS: "common",
|
||||
fallbackLng: "en",
|
||||
interpolation: {
|
||||
escapeValue: false,
|
||||
},
|
||||
initImmediate: false // Makes loading blocking but sync
|
||||
});
|
||||
|
||||
import express from "express";
|
||||
const app = express();
|
||||
@@ -13,10 +26,14 @@ import api from "./routes/api/api-controller";
|
||||
app.use("/api", api);
|
||||
|
||||
// serve
|
||||
app.listen(PORT, () => {
|
||||
console.log(`http://localhost:${PORT}`);
|
||||
});
|
||||
if (import.meta.env.PROD) {
|
||||
app.listen(PORT, () => {
|
||||
console.log(`http://localhost:${PORT}`);
|
||||
});
|
||||
}
|
||||
|
||||
process.on('unhandledRejection', (reason, promise) => {
|
||||
console.error('Unhandled Rejection at:', promise, 'reason:', reason);
|
||||
});
|
||||
|
||||
export const viteNodeApp = app;
|
||||
@@ -43,6 +43,11 @@ router.post("/:workflowUuid?", [
|
||||
}
|
||||
}
|
||||
|
||||
if(!workflow.actions) {
|
||||
res.status(400).json({error: "The provided workflow does not contain any actions."});
|
||||
return
|
||||
}
|
||||
|
||||
const validationResults = await JoiPDFFileSchema.validateAsync(req.files);
|
||||
if(validationResults.error) {
|
||||
res.status(400).json({error: "PDF validation failed", details: validationResults.error.message});
|
||||
|
||||
Reference in New Issue
Block a user