Skip to content

Commit

Permalink
Update index.ts
Browse files Browse the repository at this point in the history
  • Loading branch information
Mqxx committed Oct 21, 2024
1 parent 34539cd commit 021d806
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions src/index.ts
Original file line number Diff line number Diff line change
@@ -1,14 +1,24 @@
import createDnsRecord from './api/create_dns_record.ts';
import listDnsRecords from './api/list_dns_records.ts';
import {parseRequestURL} from './request/url/mod.ts'

export default {
/**
* [Reference](https://developers.cloudflare.com/workers/runtime-apis/handlers/fetch/)
* [Cloudflare Reference](https://developers.cloudflare.com/workers/runtime-apis/handlers/fetch/)
*
* @param request Incoming http request
*/
async fetch(request : Request) : Promise<void> {
const requestUrl = new URL(request.url)
const requestUrlParameters = parseRequestURL(requestUrl)
const {token, zoneId, records} = parseRequestURL(requestUrl)

const existingRecords = await listDnsRecords({token, zoneId})

existingRecords.forEach((record) => {

})
records.forEach((record) => {
createDnsRecord(record, {token, zoneId})
})
}
}

0 comments on commit 021d806

Please sign in to comment.