0
0
mirror of https://github.com/naturalcrit/homebrewery.git synced 2026-03-22 08:58:11 +00:00
This commit is contained in:
Víctor Losada Hernández
2026-03-03 23:44:02 +01:00
parent 828bba61de
commit 8d18529c6d
24 changed files with 2679 additions and 2687 deletions

View File

@@ -1,33 +1,33 @@
import DB from "./server/db.js";
import createApp from "./server/app.js";
import config from "./server/config.js";
import { createServer as createViteServer } from "vite";
import DB from './server/db.js';
import createApp from './server/app.js';
import config from './server/config.js';
import { createServer as createViteServer } from 'vite';
const isDev = process.env.NODE_ENV === "local";
const isDev = process.env.NODE_ENV === 'local';
async function start() {
let vite;
if (isDev) {
if(isDev) {
vite = await createViteServer({
server: { middlewareMode: true },
appType: "custom",
server : { middlewareMode: true },
appType : 'custom',
});
}
await DB.connect(config).catch((err) => {
console.error("Database connection failed:", err);
await DB.connect(config).catch((err)=>{
console.error('Database connection failed:', err);
process.exit(1);
});
const app = await createApp(vite);
const PORT = process.env.PORT || config.get("web_port") || 3000;
app.listen(PORT, () => {
const reset = "\x1b[0m"; // Reset to default style
const bright = "\x1b[1m"; // Bright (bold) style
const cyan = "\x1b[36m"; // Cyan color
const underline = "\x1b[4m"; // Underlined style
const PORT = process.env.PORT || config.get('web_port') || 3000;
app.listen(PORT, ()=>{
const reset = '\x1b[0m'; // Reset to default style
const bright = '\x1b[1m'; // Bright (bold) style
const cyan = '\x1b[36m'; // Cyan color
const underline = '\x1b[4m'; // Underlined style
console.log(`\n\tserver started at: ${new Date().toLocaleString()}`);
console.log(`\tserver on port: ${PORT}`);