Fix serverless functions: simplify API structure

- Replace complex Express-style handler with simple module.exports
- Add separate API endpoints for better organization
- Simplify vercel.json routing configuration
- Remove ES modules to use CommonJS for Vercel compatibility
- Add dedicated test API endpoint for debugging
This commit is contained in:
2025-08-21 13:32:53 +09:00
parent ec5da4db32
commit 08894eeb66
5 changed files with 73 additions and 43 deletions

View File

@@ -1,5 +1,5 @@
// Vercel Serverless 함수 핸들러
export default function handler(req, res) {
module.exports = function handler(req, res) {
// CORS 헤더 설정
res.setHeader('Access-Control-Allow-Origin', '*');
res.setHeader('Access-Control-Allow-Methods', 'GET, POST, PUT, DELETE, OPTIONS');
@@ -27,7 +27,7 @@ export default function handler(req, res) {
// 루트 경로
if (url === '/' || url === '/api') {
res.setHeader('Content-Type', 'text/html');
res.send(`
res.end(`
<!DOCTYPE html>
<html lang="ko">
<head>