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:
21
api/test.js
Normal file
21
api/test.js
Normal file
@@ -0,0 +1,21 @@
|
||||
// 테스트용 간단한 API
|
||||
module.exports = (req, res) => {
|
||||
// CORS 헤더 설정
|
||||
res.setHeader('Access-Control-Allow-Origin', '*');
|
||||
res.setHeader('Access-Control-Allow-Methods', 'GET, POST, OPTIONS');
|
||||
res.setHeader('Access-Control-Allow-Headers', 'Content-Type');
|
||||
|
||||
if (req.method === 'OPTIONS') {
|
||||
res.status(200).end();
|
||||
return;
|
||||
}
|
||||
|
||||
// 간단한 응답
|
||||
res.status(200).json({
|
||||
success: true,
|
||||
message: 'API가 정상 작동합니다!',
|
||||
timestamp: new Date().toISOString(),
|
||||
url: req.url,
|
||||
method: req.method
|
||||
});
|
||||
};
|
Reference in New Issue
Block a user