ryu-js / plugins /gempa.js
randydev's picture
Create gempa.js
5fa914f verified
raw
history blame
637 Bytes
import express from 'express';
import { GempaBumi } from '../scrapper.js';
const GempaRoutes = express.Router();
/**
* @swagger
* /api/v1/gempa-bumi:
* get:
* summary: gempa bumi Random
* responses:
* 200:
* description: Success
*/
TebakRoutes.get('/api/v1/gempa-bumi', async (req, res) => {
try {
const result = await GempaBumi();
if (result) {
res.json({ result });
} else {
res.status(404).json({ error: "No result found." });
}
} catch (error) {
res.status(500).json({ error: error.message });
}
});
export { GempaRoutes };