Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/foxfirecodes/edge-counter
a super minimal repo showing how to write raw edge functions with Vercel
https://github.com/foxfirecodes/edge-counter
Last synced: 5 days ago
JSON representation
a super minimal repo showing how to write raw edge functions with Vercel
- Host: GitHub
- URL: https://github.com/foxfirecodes/edge-counter
- Owner: foxfirecodes
- Created: 2023-07-17T20:51:41.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2024-09-04T13:59:43.000Z (4 months ago)
- Last Synced: 2024-12-25T05:21:05.581Z (12 days ago)
- Language: TypeScript
- Homepage: https://edge-counter-phi.vercel.app
- Size: 44.9 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# edge-counter
> a super minimal repo showing how to write raw edge functions with Vercel
## takeaways
- you MUST include `export const config = { runtime: 'edge' }` in your routes. unlike Next.JS, you can't use `export const runtime = 'edge'`. omitting this will result in an API route that just times out.
- you MUST have a non-empty `public` directory. if you don't actually need anything public, just throw an empty file in there to make Vercel happy. for this project I threw some bare-bones HTML in there.
- for some reason, Vercel builds report TypeScript errors that simply aren't real. idk why, but the deployment itself works fine.
- if you want to develop locally (i.e. `vercel dev`), you WILL need to set up a tsconfig. however this isn't technically needed to deploy.
- execution time is around the same as using an edge function in a Next.JS app.## setup
```bash
# clone the repo
git clone [email protected]:rayzr522/edge-counter.git
cd edge-counter# install deps
pnpm install# run vercel's dev server locally
pnpm vercel dev
```