Skip to content

Instantly share code, notes, and snippets.

View manishsujangarh's full-sized avatar

Manish Kumar Sharma manishsujangarh

View GitHub Profile
addEventListener('fetch', event => {
event.respondWith(handleRequest(event.request))
})
async function handleRequest(request) {
const url = new URL(request.url)
// Check if the path starts with /blog
if (url.pathname.startsWith('/blog')) {
const subPath = url.pathname.replace('/blog', '')
const githubUrl = new URL(`SOURCE_URL${subPath}`)