import { getBackendUrl } from "alchemy/cloudflare/bun-spa"; import { useState } from "react"; import "./App.css"; import bunLogo from "./assets/logo.svg"; import reactLogo from "./assets/react.svg"; const apiBaseUrl = getBackendUrl(); function backendUrl(path: string) { return new URL(path, apiBaseUrl); } function App() { const [count, setCount] = useState(0); const [message, setMessage] = useState(""); const callBackend = async () => { const response = await fetch(backendUrl("/api/hello")); const data = (await response.json()) as { message: string }; setMessage(data.message); }; return ( <>
Bun logo React logo

Bun + React

Edit src/App.tsx and save to test HMR

{message &&

Response: {message}

}

Click on the Bun and React logos to learn more

); } export default App;