BREAKING: merge API routes and pages concept (#53)
This commit merges API routes and pages into a single concept. The pages/api folder is now not special anymore.
This commit is contained in:
@@ -1,11 +1,12 @@
|
||||
export function GET() {
|
||||
return new Response("Get fresh!", {
|
||||
headers: {
|
||||
"Content-Type": "application/json; charset=utf-8",
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
export function NOTAMETHOD() {
|
||||
return new Response("unreachable");
|
||||
}
|
||||
export const handler = {
|
||||
GET() {
|
||||
return new Response("Get fresh!", {
|
||||
headers: {
|
||||
"Content-Type": "application/json; charset=utf-8",
|
||||
},
|
||||
});
|
||||
},
|
||||
NOTAMETHOD() {
|
||||
throw new Error("unreachable");
|
||||
},
|
||||
};
|
||||
|
||||
@@ -1,15 +0,0 @@
|
||||
export default () => {
|
||||
return new Response(JSON.stringify({ name: "fresh" }), {
|
||||
headers: {
|
||||
"Content-Type": "application/json; charset=utf-8",
|
||||
},
|
||||
});
|
||||
};
|
||||
|
||||
export function GET() {
|
||||
return new Response("Get fresh!", {
|
||||
headers: {
|
||||
"Content-Type": "application/json; charset=utf-8",
|
||||
},
|
||||
});
|
||||
}
|
||||
Reference in New Issue
Block a user