// Next.js API route support: https://nextjs.org/docs/api-routes/introduction

import { getBookedDays } from '../../db/index'

export default async function useHandler(req, res) {
  const { method } = req

  switch (method) {
    case 'GET':
      const days = await getBookedDays()
      res.statusCode = 200
      res.json(days)
      break
    default:
      res.setHeader('Allow', ['GET'])
      res.status(405).end(`Method ${method} Not Allowed`)
  }
}
