21 lines
575 B
JavaScript
21 lines
575 B
JavaScript
import express from 'express';
|
|
import path from 'path';
|
|
import { fileURLToPath } from 'url';
|
|
import chatRouter from './routers/chatRouter.js';
|
|
import bodyParser from 'body-parser';
|
|
|
|
const __filename = fileURLToPath(import.meta.url);
|
|
const __dirname = path.dirname(__filename);
|
|
|
|
const app = express();
|
|
|
|
app.use(bodyParser.json());
|
|
app.use('/api/chat', chatRouter);
|
|
app.use('/images', express.static(path.join(__dirname, '../frontend/public/images')));
|
|
|
|
app.get('*', (req, res) => {
|
|
res.sendFile(path.join(__dirname, '../frontend/dist/index.html'));
|
|
});
|
|
|
|
export default app;
|