Actualizar control de glucemias con eje Y secundario para correcciones e integracion de tienda
This commit is contained in:
@@ -0,0 +1,34 @@
|
||||
import express from 'express';
|
||||
import path from 'path';
|
||||
import { createServer as createViteServer } from 'vite';
|
||||
import apiApp from './server/index.js';
|
||||
|
||||
async function startServer() {
|
||||
const app = express();
|
||||
const PORT = 3000;
|
||||
const HOST = '0.0.0.0';
|
||||
|
||||
// Mount API routes
|
||||
app.use(apiApp);
|
||||
|
||||
// Vite middleware for development or static serving for production
|
||||
if (process.env.NODE_ENV !== 'production') {
|
||||
const vite = await createViteServer({
|
||||
server: { middlewareMode: true },
|
||||
appType: 'spa',
|
||||
});
|
||||
app.use(vite.middlewares);
|
||||
} else {
|
||||
const distPath = path.join(process.cwd(), 'dist');
|
||||
app.use(express.static(distPath));
|
||||
app.get('*', (_req, res) => {
|
||||
res.sendFile(path.join(distPath, 'index.html'));
|
||||
});
|
||||
}
|
||||
|
||||
app.listen(PORT, HOST, () => {
|
||||
console.log(`Hospital Server running on http://${HOST}:${PORT}`);
|
||||
});
|
||||
}
|
||||
|
||||
startServer();
|
||||
Reference in New Issue
Block a user