Add simple test API
This commit is contained in:
parent
e49ada09ba
commit
5737c6e1f0
1 changed files with 31 additions and 0 deletions
31
pages/api/test-simple.js
Normal file
31
pages/api/test-simple.js
Normal file
|
|
@ -0,0 +1,31 @@
|
|||
export default function handler(req, res) {
|
||||
// Set CORS headers
|
||||
res.setHeader('Access-Control-Allow-Origin', '*');
|
||||
res.setHeader('Access-Control-Allow-Methods', 'GET, POST, PUT, DELETE, OPTIONS');
|
||||
res.setHeader('Access-Control-Allow-Headers', 'Content-Type, Authorization');
|
||||
|
||||
// Handle preflight requests
|
||||
if (req.method === 'OPTIONS') {
|
||||
res.status(200).end();
|
||||
return;
|
||||
}
|
||||
|
||||
if (req.method !== 'GET') {
|
||||
return res.status(405).json({ error: 'Method not allowed' });
|
||||
}
|
||||
|
||||
try {
|
||||
return res.status(200).json({
|
||||
success: true,
|
||||
message: 'Simple test API is working!',
|
||||
timestamp: new Date().toISOString(),
|
||||
method: req.method,
|
||||
url: req.url
|
||||
});
|
||||
} catch (error) {
|
||||
console.error('❌ Error in simple test API:', error);
|
||||
return res.status(500).json(
|
||||
{ error: 'Simple test API failed', details: error.message }
|
||||
);
|
||||
}
|
||||
}
|
||||
Loading…
Reference in a new issue