const headers = { 'Content-Type': 'text/html' }
const template = require('./repo-hunt-templates-index')
import Day from './repo-hunt-store-day'

const handler = async () => {
  try {
    let repos = await Day.getRepos()
    return new Response(template(repos), { headers })
  } catch (err) {
    return new Response(`Error! ${err.toString()} for ${JSON.stringify(repos)}`)
  }
}

export default handler