import Router from './repo-hunt-router'
import index from './repo-hunt-handlers-index'
import post from './repo-hunt-handlers-post'
import create from './repo-hunt-handlers-create'

function handleRequest(request) {
    const r = new Router()
    r.get('/repo-hunt', index)
    r.get('/repo-hunt/post', post)
    r.post('/repo-hunt/repo', create)
    return r.route(request)
}
                    
addEventListener("fetch", event => {
    return event.respondWith(handleRequest(event.request))
})