Last active
April 28, 2021 05:01
-
-
Save kt3k/f7a83339c0474279fb0ec37966ea38cf to your computer and use it in GitHub Desktop.
dts -> ts -> dts
This file contains hidden or 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
addEventListener("fetch", (e) => { | |
const pathname = new URL(e.request.url).pathname; | |
switch (pathname) { | |
case "/foo.ts": { | |
e.respondWith(new Response("export * from './bar'", { | |
headers: { | |
"content-type": "application/typescript", | |
} | |
})); | |
return; | |
} | |
case "/bar": { | |
e.respondWith(new Response("export {}", { | |
headers: { | |
"content-type": "application/typescript", | |
} | |
})); | |
return; | |
} | |
default: { | |
e.respondWith(new Response("404 Not Found", { status: 404 })); | |
return; | |
} | |
} | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment