import { NextApiHandler } from 'next' const checkoutApi = async (req: any, res: any, config: any) => { try { const html = ` Checkout

Checkout not implemented :(

See #64

` res.status(200) res.setHeader('Content-Type', 'text/html') res.write(html) res.end() } catch (error) { console.error(error) const message = 'An unexpected error ocurred' res.status(500).json({ data: null, errors: [{ message }] }) } } export function createApiHandler( handler: any, handlers: H, defaultOptions: Options ) { return function getApiHandler({ config, operations, options, }: { config?: any operations?: Partial options?: Options extends {} ? Partial : never } = {}): NextApiHandler { const ops = { ...operations, ...handlers } const opts = { ...defaultOptions, ...options } return function apiHandler(req, res) { return handler(req, res, config, ops, opts) } } } export default createApiHandler(checkoutApi, {}, {})