AFFiNE/apps/core/server.mts

19 lines
416 B
TypeScript
Raw Normal View History

2023-07-18 19:53:10 +03:00
// static server for web app
import express from 'express';
const app = express();
const PORT = process.env.PORT || 8080;
app.use('/', express.static('dist'));
2023-08-04 02:05:46 +03:00
app.get('/*', (req, res) => {
if (req.url.startsWith('/plugins')) {
res.sendFile(req.url, { root: 'dist' });
}
2023-07-18 19:53:10 +03:00
res.sendFile('index.html', { root: 'dist' });
});
app.listen(PORT, () => {
console.log(`Server is running on port ${PORT}`);
});