mirror of
https://github.com/toeverything/AFFiNE.git
synced 2024-12-20 08:32:02 +03:00
19 lines
416 B
TypeScript
19 lines
416 B
TypeScript
// static server for web app
|
|
import express from 'express';
|
|
const app = express();
|
|
|
|
const PORT = process.env.PORT || 8080;
|
|
|
|
app.use('/', express.static('dist'));
|
|
|
|
app.get('/*', (req, res) => {
|
|
if (req.url.startsWith('/plugins')) {
|
|
res.sendFile(req.url, { root: 'dist' });
|
|
}
|
|
res.sendFile('index.html', { root: 'dist' });
|
|
});
|
|
|
|
app.listen(PORT, () => {
|
|
console.log(`Server is running on port ${PORT}`);
|
|
});
|