File size: 756 Bytes
f2bfd2b 82f4905 43c2f75 f2bfd2b 43c2f75 bd1b1fd f2bfd2b |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 |
import express from 'express';
import { tebakgambar } from '../lib/scrapper.js';
import { authenticateApiKey, apiLimiter } from '../middleware/midware.js';
const TebakRoutes = express.Router();
/**
* @swagger
* /api/v1/tebakgambar:
* get:
* summary: tebak gambar Random
* responses:
* 200:
* description: Success
*/
TebakRoutes.get('/api/v1/tebakgambar', authenticateApiKey, apiLimiter, async (req, res) => {
try {
const result = await tebakgambar();
if (result) {
res.json({ result });
} else {
res.status(404).json({ error: "No result found." });
}
} catch (error) {
res.status(500).json({ error: error.message });
}
});
export { TebakRoutes }; |