import { APIEvent } from "@solidjs/start/server";export function GET(event: APIEvent) { event.nativeEvent.waitUntil(send()); return Response.json("Optimistically sent a message!");}async function send() { await fetch(`https://discord.com/api/v10/channels/CHANNEL/messages`, { method: "POST", headers: { "Content-Type": "application/json", Authorization: `Bot TOKEN`, }, body: JSON.stringify({ content: "", }), });}
import { render } from "solid-js/web";import { Router, Route, useNavigate } from "@solidjs/router";function Home() { console.log("ran"); return <h1>Home</h1>;}function App() { return ( <Router> <Route preload={() => useNavigate()("/other")} path="/" component={Home} /> <Route path="/other" component={Other} /> </Router> );}function Other() { return ( <> <h1>Other</h1> <a href="/">Home</a> </> );}render(() => <App />, document.getElementById("app"));
function App() { const redirect = useNavigate(); return ( <Router> <Route preload={() => redirect("/other")} path="/" component={Home} /> <Route path="/other" component={Other} /> </Router> );}
import { render } from "solid-js/web";import { Router, Route } from "@solidjs/router";function Home() { return <h1>Home</h1>;}function App() { return ( <Router> <Route preload={() => Response.redirect("/other")} path="/" component={Home} /> <Route path="/other" component={Other} /> </Router> );}function Other() { return <h1>Other</h1>;}render(() => <App />, document.getElementById("app"));