New Oct 8, 2024

Best Practice for Astro Endpoints

More Front-end Bloggers All from Zell Liew View Best Practice for Astro Endpoints on zellwk.com

(Hey, we're having problems showing images in RSS right now, so if you want a better reading experience, consider viewing this article online [here](https://zellwk.com//blog/astro-endpoint-best-practice. We hope to fix this soon!).

Astro strips away query parameters from endpoints if you're in a static rendering mode. So, unless you're using SSR for all your pages, you'll need to ensure that your endpoints are not pre-rendered.

{/* prettier-ignore */}

// Make sure this is there
export const prerender = false 

// All your endpoints go here export function GET () {/* ... /} export function POST () {/ ... /} export function PATCH () {/ ... /} export function DELETE () {/ ... */}

This will save you lots of headaches when debugging Astro endpoints.

Scroll to top