Content pfp
Content
@
0 reply
0 recast
0 reaction

Deployer pfp
Deployer
@deployer
When you drop a Hamcaster link in a cast it generates a frame image on the fly. It uses netlify edge functions. Edge functions use a deno like runtime so instead of trying to generate the image in the function, I make a call to my API server to generate the image and return the data. The edge function then modifies the HTML and inserts the required meta tags. I really like this lightweight approach. I can stick to my static react front end and my scalable load balanced API server on AWS and not be locked into vercel. You can do a similar thing with edge lambdas on AWS but since Hamcaster already used Netlify I thought I'd try out their edge functions. Not a big fan of deno but by offloading the image generation to the API server I didn't have to deal with package compatibility or database connections in the edge function. https://hamcaster.com/token/4482
8 replies
5 recasts
17 reactions

jtgi pfp
jtgi
@jtgi
Is it because there’s built in caching with the edge functions? Why not just hit the api server directly, for example.
1 reply
0 recast
0 reaction

Deployer pfp
Deployer
@deployer
The edge function intercepts the browser request to the page and lets you modify the response. The app is not server rendered, so this allows me the benefit of dynamic meta tags even though its rendered on the client. Also yes there's caching built in, but given the data in the image can update often I'm not utilizing it. So you can just share the token link it renders the frame. Basically trying to point out that you can get dynamic meta tags and content without using something like Next JS, or setting up server rendering for your react app.
1 reply
0 recast
2 reactions

jtgi pfp
jtgi
@jtgi
Gotcha. Nice workaround.
0 reply
0 recast
0 reaction