astro/.changeset/twelve-coats-rush.md
Emanuele Stoppa 0f06255041 feat: upper case the name of the endpoints (#7783)
Co-authored-by: Bjorn Lu <bjornlu.dev@gmail.com>
Co-authored-by: Yan Thomas <61414485+Yan-Thomas@users.noreply.github.com>
Co-authored-by: Chris Swithinbank <swithinbank@gmail.com>
2023-08-08 11:01:33 +01:00

803 B

astro
major

Lowercase names for endpoint functions are now deprecated.

Rename functions to their uppercase equivalent:

- export function get() {
+ export function GET() {
    return new Response(JSON.stringify({ "title": "Bob's blog" }));
}

- export function post() {
+ export function POST() {
    return new Response(JSON.stringify({ "title": "Bob's blog" }));
}

- export function put() {
+ export function PUT() {
    return new Response(JSON.stringify({ "title": "Bob's blog" }));
}

- export function all() {
+ export function ALL() {
    return new Response(JSON.stringify({ "title": "Bob's blog" }));
}

// you can use the whole word "DELETE"
- export function del() {
+ export function DELETE() {
    return new Response(JSON.stringify({ "title": "Bob's blog" }));
}