import { APIEvent } from "@solidjs/start/server";
export async function POST(event: APIEvent) {
const data = new FormData();
data.set("message", "test");
event.nativeEvent.respondWith(
Response.json({ message: "Optimistically sent a message!" })
);
await fetch(`https://discord.com/api/v10/channels/CHANNEL/messages`, {
method: "POST",
headers: {
"Content-Type": "application/json",
Authorization: `Bot TOKEN`,
},
body: JSON.stringify({ content: String(data.get("message")) }),
});
}
import { APIEvent } from "@solidjs/start/server";
export async function POST(event: APIEvent) {
const data = new FormData();
data.set("message", "test");
event.nativeEvent.respondWith(
Response.json({ message: "Optimistically sent a message!" })
);
await fetch(`https://discord.com/api/v10/channels/CHANNEL/messages`, {
method: "POST",
headers: {
"Content-Type": "application/json",
Authorization: `Bot TOKEN`,
},
body: JSON.stringify({ content: String(data.get("message")) }),
});
}