23 lines
620 B
JavaScript
23 lines
620 B
JavaScript
const express = require('express');
|
|
const cors = require('cors');
|
|
const path = require('path');
|
|
|
|
const app = express();
|
|
const PORT = process.env.PORT || 3000;
|
|
|
|
app.use(cors());
|
|
app.use(express.json());
|
|
app.use(express.static(path.join(__dirname, 'dist')));
|
|
|
|
app.get('/health', (_req, res) => {
|
|
res.json({ status: 'healthy', service: 'app', version: '1.3.0' });
|
|
});
|
|
|
|
app.get('*', (_req, res) => {
|
|
res.sendFile(path.join(__dirname, 'dist', 'index.html'));
|
|
});
|
|
|
|
app.listen(PORT, () => {
|
|
console.log(JSON.stringify({ ts: new Date().toISOString(), level: 'info', service: 'app', msg: `running on port ${PORT}` }));
|
|
});
|