20 lines
525 B
TypeScript
20 lines
525 B
TypeScript
|
|
import express from 'express';
|
||
|
|
import cors from 'cors';
|
||
|
|
import routes from './routes.js';
|
||
|
|
import ui from './ui.js';
|
||
|
|
|
||
|
|
const app = express();
|
||
|
|
const PORT = Number(process.env.PORT) || 3070;
|
||
|
|
|
||
|
|
app.use(express.json({ limit: '5mb' })); // article HTML can be sizeable
|
||
|
|
app.use(cors()); // the extension calls this from arbitrary page origins
|
||
|
|
|
||
|
|
app.use('/api', routes);
|
||
|
|
app.use('/', ui);
|
||
|
|
|
||
|
|
app.get('/api/health', (_req, res) => res.json({ ok: true }));
|
||
|
|
|
||
|
|
app.listen(PORT, () => {
|
||
|
|
console.log(`stash server listening on :${PORT}`);
|
||
|
|
});
|