/** * kordoc 마이크로서비스 — HWP/HWPX/PDF → Markdown 변환 API */ const express = require('express'); const app = express(); const PORT = 3100; app.use(express.json({ limit: '500mb' })); // 헬스체크 app.get('/health', (req, res) => { res.json({ status: 'ok', service: 'kordoc' }); }); // 문서 파싱 app.post('/parse', async (req, res) => { try { const { filePath } = req.body; if (!filePath) { return res.status(400).json({ error: 'filePath is required' }); } // TODO: kordoc 라이브러리 연동 (Phase 1에서 구현) // const kordoc = require('kordoc'); // const result = await kordoc.parse(filePath); // return res.json(result); return res.json({ markdown: '', metadata: {}, format: 'unknown', message: 'kordoc 파싱은 Phase 1에서 구현 예정' }); } catch (err) { res.status(500).json({ error: err.message }); } }); // 문서 비교 app.post('/compare', async (req, res) => { try { const { filePathA, filePathB } = req.body; if (!filePathA || !filePathB) { return res.status(400).json({ error: 'filePathA and filePathB are required' }); } // TODO: kordoc compare 구현 (Phase 2) return res.json({ diffs: [], message: 'compare는 Phase 2에서 구현 예정' }); } catch (err) { res.status(500).json({ error: err.message }); } }); app.listen(PORT, () => { console.log(`kordoc-service listening on port ${PORT}`); });