This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var DOMParser = require('xmldom').DOMParser; | |
var fs = require('fs'); | |
var path = require('path'); | |
function convertBack(xml) { | |
const parser = new DOMParser(); | |
const xmlDoc = parser.parseFromString(xml, 'text/xml'); | |
const jsonOutput = {}; | |
const rootNode = xmlDoc.getElementsByTagName('node')[0]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { json } from 'https://pkg.do/itty-router-extras' | |
export default { | |
fetch: req => json({ hello: 'Matthew', from: req.cf.city }) | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* Ultra lightweight Github REST Client */ | |
// original inspiration via https://gist.github.com/v1vendi/75d5e5dad7a2d1ef3fcb48234e4528cb | |
const token = 'github-token-here' | |
const githubClient = generateAPI('https://api.github.com', { | |
headers: { | |
'User-Agent': 'xyz', | |
'Authorization': `bearer ${token}` | |
} | |
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { json } from 'https://pkg.do/itty-router-extras' | |
export default { | |
fetch: req => json(req) | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import curlToHar from 'https://pkg.do/curl-to-har' | |
import { json } from 'https://pkg.do/itty-router-extras' | |
export default { | |
fetch: req => { | |
const { origin, pathname, search } new URL(req.url) | |
const curl = curlToHar(pathname + search) | |
return json({curl}) | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
export default { | |
fetch: req => json(northwind) | |
} | |
const json = obj => new Response(JSON.stringify(obj, null, 2), { headers: { 'content-type': 'application/json; charset=utf-8' }}) | |
const northwind = { | |
"Category": [ | |
{ | |
"picture": null, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
export default { | |
fetch: req => fetch('https://zapier.com/api/v4/implementations-meta/public/', { headers: { accept: 'application/json' }}) | |
} |
css |
---|
LINEAR - LIMITED BETA RELEASE
Linear helps streamline software projects, sprints, tasks, and bug tracking. It's built for high-performance teams.
enter your work email Request Early Access
NewerOlder