/** * 로컬 테스트용 정적 서버 — imweb-members.html 을 아임웹 페이지처럼 감싸서 띄운다. * * node imweb/serve-local.js → http://localhost:5173/imweb-members.html * * 포트 5173 은 백엔드 CORS 기본 허용 주소(FRONTEND_URL)와 루트 env 의 * IMWEB_ADMIN_PAGE_URL 에 맞춘 것이다. 바꾸면 두 곳도 함께 바꿔야 한다. */ const http = require('http'); const fs = require('fs'); const path = require('path'); const PORT = 5173; const PAGE = 'imweb-members.html'; http .createServer((req, res) => { const name = path.basename(new URL(req.url, 'http://localhost').pathname) || PAGE; if (name !== PAGE) { res.writeHead(302, { Location: `/${PAGE}` }); res.end(); return; } fs.readFile(path.join(__dirname, PAGE), 'utf8', (err, html) => { if (err) { res.writeHead(500); res.end(String(err)); return; } res.writeHead(200, { 'Content-Type': 'text/html; charset=utf-8' }); res.end( '' + '' + '회원 유입경로 (로컬)' + `${html}`, ); }); }) .listen(PORT, '127.0.0.1', () => { process.stdout.write(`http://localhost:${PORT}/${PAGE}\n`); });