'use strict' import { Operation } from 'express-openapi' import botsService from '../src/data/bots' export default function() { const GET: Operation = async (req, res, next) => { try { res.status(200).json(await botsService.getBots()) } catch (error) { res.status(error.code).send(error.message) } } const POST: Operation = async (req, res, next) => { try { res.status(200).json(await botsService.postBot(req)) } catch (error) { res.status(error.code).send(error.message) } } return { GET, POST } }