-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
this could be consider premium dogshit
- Loading branch information
Showing
7 changed files
with
57 additions
and
12 deletions.
There are no files selected for viewing
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
src/pages/api/premium/twitterSearch.ts → archive/twitterSearch.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
import { NextApiRequest, NextApiResponse } from 'next'; | ||
import { checkApiKey } from '@utils/checkApiKey'; | ||
|
||
export default async function handler( | ||
req: NextApiRequest, | ||
res: NextApiResponse | ||
) { | ||
if (req.method !== 'GET') { | ||
return res.status(405).json({ error: 'Method not allowed' }); | ||
} | ||
|
||
if (!process.env.Local_Node_Api) { | ||
return res.status(500).json({ error: 'Local Node API is not set' }); | ||
} | ||
|
||
const apiKey = req.headers['x-api-key']; | ||
if (!apiKey) { | ||
return res.status(401).json({ error: 'API key is required' }); | ||
} | ||
|
||
try { | ||
const isValid = await checkApiKey(apiKey as string); | ||
if (!isValid) { | ||
return res.status(401).json({ error: 'Invalid API key' }); | ||
} | ||
const response = await fetch(process.env.Local_Node_Api as string) | ||
const data = await response.json() | ||
console.log(data) | ||
return res.status(200).json(data) | ||
|
||
} catch (error) { | ||
console.error('Twitter fetch error:', error); | ||
return res.status(500).json({ | ||
success: false, | ||
error: 'Failed to fetch tweets' | ||
}); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters