4 ms·
Still waiting for the long-promised *non*-Next.js examples, though: https://github.com/vercel/examples/tree/main/edge-functions https://github.com/vercel/examp
by brycewray 4y ago
Still waiting for the long-promised *non*-Next.js examples, though:
https://github.com/vercel/examples/tree/main/edge-functions https://github.com/vercel/examples/tree/main/edge-functions
:-/
- leerob 4y agoHere's an example with SvelteKit[1]. You can put a middleware.ts (or.js) in the root folder of any framework and it will work. We also have examples for using Edge API Routes, which work with any framework[2]. [1]: https://github.com/vercel/examples/pull/320 https://github.com/vercel/examples/pull/320 [2]: https://github.com/vercel/examples/tree/main/edge-api-routes https://github.com/vercel/examples/tree/main/edge-api-routes
- okbel 4y agoHi!!! `vercel/examples` maintainer here. We have some with Svelte and plain edge examples, but more importantly, what would you like to see?
- brycewray 4y agookbel, thanks for the reply. I am interested in translating a Cloudflare Worker (and I know that's the tech underneath Vercel Edge Functions, as leerob indicated last year) that, on my site on Cloudflare Pages, manipulates headers for assets-caching and a Content Security Policy. This is framework-agnostic — I've used it with Hugo, Eleventy, and Astro. Thus, any headers-related examples which *don't* start with `import { NextResponse } from 'next/server'` would be very helpful. :-D Again, thanks, and congratulations on today's launch to GA.
- guibibeau 4y agoWould an example with a custom CSP be useful ?
- brycewray 4y agoguibibeau, that would help, too (although I presume it still would come under the subject of HTTP headers). In short: *any* examples that *don't* require any part of Next.js --- or any other specific framework --- would be what a number of us have wanted since last fall's announcement. Thanks!