forked from dfinity/candid
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: add the wrangler configuration and worker code for auth.ic0.app (
dfinity#244) And fix accessToken which was changed in a parallel PR.
- Loading branch information
Showing
9 changed files
with
905 additions
and
6 deletions.
There are no files selected for viewing
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
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
node_modules/ | ||
worker/ |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
import { getAssetFromKV, serveSinglePageApp } from '@cloudflare/kv-asset-handler'; | ||
|
||
addEventListener('fetch', event => { | ||
try { | ||
event.respondWith(handleEvent(event)) | ||
} catch (e) { | ||
if (DEBUG) { | ||
return event.respondWith( | ||
new Response(e.message || e.toString(), { | ||
status: 500, | ||
}), | ||
) | ||
} | ||
event.respondWith(new Response('Internal Error', { status: 500 })) | ||
} | ||
}) | ||
|
||
async function handleEvent(event) { | ||
/** | ||
* You can add custom logic to how we fetch your assets | ||
* by configuring the function `mapRequestToAsset`. | ||
* In this case, we serve a single page app from index.html. | ||
*/ | ||
|
||
const response = await getAssetFromKV(event, { mapRequestToAsset: serveSinglePageApp }) | ||
return response | ||
} |
Oops, something went wrong.