File size: 1,313 Bytes
5179f39 5f24c60 5179f39 81c70b4 5179f39 5940255 5179f39 b426a04 5179f39 |
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 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 |
import express from 'express';
import { FontStyleCheckAPI } from '../lib/all.js';
import { authenticateApiKey, apiLimiter } from '../middleware/midware.js';
const FontsRoutes = express.Router();
/**
* @swagger
* /api/v1/fonts-stylish/detected:
* get:
* summary: Fonts Styles
* tags: [Fonts]
* parameters:
* - in: query
* name: query
* required: true
* description: Font Stylish Text if checked detected
* schema:
* type: string
* - in: header
* name: x-api-key
* required: true
* description: API key for authentication
* schema:
* type: string
* responses:
* 200:
* description: Success
*/
FontsRoutes.get('/api/v1/fonts-stylish/detected', authenticateApiKey, apiLimiter, async (req, res) => {
try {
const query = req.query.query
if (!query) {
return res.status(401).json({ error: "Invalid Query." });
}
const results = await FontStyleCheckAPI(query);
if (results) {
res.json({ results });
} else {
res.status(404).json({ error: "No result found." });
}
} catch (error) {
res.status(500).json({ error: error.message });
}
});
export { FontsRoutes }; |