Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- addEventListener('fetch', event => {
- event.respondWith(handleRequest(event.request))
- })
- let res = {
- json: function(json){
- return new Response(JSON.stringify(json),{'headers':{'Content-Type':'application/json'}});
- }
- };
- async function handleRequest(request) {
- console.log('Got request', request) ;
- return res.json({
- "success":true,
- "message":"Hello World"
- })
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement