Add minimal add-in playgrounds and orchestrator

This commit is contained in:
2025-12-07 21:26:10 -06:00
parent 40bcd939ff
commit ca95d296b5
54 changed files with 13165 additions and 26764 deletions
+31
View File
@@ -0,0 +1,31 @@
/* Simple playground server: exposes /api/upload-managers which runs the run() exporter
from run.js and returns the JSON result. Meant for local development. */
require('dotenv').config();
const express = require('express');
const cors = require('cors');
const bodyParser = require('body-parser');
const path = require('path');
const { run } = require('./run');
const app = express();
app.use(cors());
app.use(bodyParser.json());
// health
app.get('/api/health', (req, res) => res.json({ ok: true, ts: new Date().toISOString() }));
// main endpoint — run the uploader flow (download workbook if env vars exist, create folders and upload PDF)
app.post('/api/upload-managers', async (req, res) => {
try {
const result = await run();
res.json({ ok: true, result });
} catch (err) {
console.error('Error in /api/upload-managers', err);
res.status(500).json({ ok: false, error: (err && err.message) ? err.message : String(err) });
}
});
const port = process.env.PLAYGROUND_PORT || 3002;
app.listen(port, () => console.log(`minimal-uploader-playground server listening on http://localhost:${port}`));