ryu-js / plugins /tebak.js
randydev's picture
Update plugins/tebak.js
82f4905 verified
raw
history blame
649 Bytes
import express from 'express';
import { tebakgambar } from '../lib/scrapper.js';
const TebakRoutes = express.Router();
/**
* @swagger
* /api/v1/tebakgambar:
* get:
* summary: tebak gambar Random
* responses:
* 200:
* description: Success
*/
TebakRoutes.get('/api/v1/tebakgambar', 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 };