LiveStormMCPrules3 matches
275276// Inject data to avoid extra round-trips
277const initialData = await fetchInitialData();
278const dataScript = `<script>
279window.__INITIAL_DATA__ = ${JSON.stringify(initialData)};
3253265. **API Design:**
327- `fetch` handler is the entry point for HTTP vals
328- Run the Hono app with
329`export default app.fetch // This is the entry point for HTTP vals`
330
Respecindex.html1 match
229try {
230// Send message to API
231const response = await fetch('/api/chat', {
232method: 'POST',
233headers: {
AppkyBookingFlow.tsx7 matches
29const [paymentSuccess, setPaymentSuccess] = useState(false);
30
31// Fetch package details
32useEffect(() => {
33const fetchPackageDetails = async () => {
34try {
35setLoading(true);
36setError(null);
37
38const response = await fetch(`/api/packages/${packageId}`);
39const result = await response.json();
40
41if (!result.success) {
42throw new Error(result.error || 'Failed to fetch package details');
43}
44
51};
52
53fetchPackageDetails();
54}, [packageId]);
55
60setError(null);
61
62const response = await fetch('/api/bookings', {
63method: 'POST',
64headers: {
134
135// Send payment request
136const response = await fetch('/api/payments/process', {
137method: 'POST',
138headers: {
AppkyPackageDetails.tsx8 matches
15const [error, setError] = useState<string | null>(null);
16
17// Fetch package details
18useEffect(() => {
19const fetchPackageDetails = async () => {
20try {
21setLoading(true);
22setError(null);
23
24// Fetch package data
25const response = await fetch(`/api/packages/${packageId}`);
26const result = await response.json();
27
28if (!result.success) {
29throw new Error(result.error || 'Failed to fetch package details');
30}
31
32setPackageData(result.data);
33
34// Fetch agency data
35const agencyResponse = await fetch(`/api/agencies/${result.data.agency_id}`);
36const agencyResult = await agencyResponse.json();
37
46};
47
48fetchPackageDetails();
49}, [packageId]);
50
AppkySearchPage.tsx1 match
73
74// Make API request
75const response = await fetch(`/api/packages/search?${queryParams.toString()}`);
76const result = await response.json();
77
untitled-9291index.ts1 match
7778// This is the entry point for HTTP vals
79export default app.fetch;
104return c.json({ success: true, data: properties });
105} catch (error) {
106console.error("Error fetching properties:", error);
107return c.json({ success: false, error: "Failed to fetch properties" }, 500);
108}
109});
116return c.json({ success: true, data: properties });
117} catch (error) {
118console.error("Error fetching featured properties:", error);
119return c.json({ success: false, error: "Failed to fetch featured properties" }, 500);
120}
121});
210return c.json({ success: true, data: users });
211} catch (error) {
212console.error("Error fetching users:", error);
213return c.json({ success: false, error: "Failed to fetch users" }, 500);
214}
215});
220return c.json({ success: true, data: agents });
221} catch (error) {
222console.error("Error fetching agents:", error);
223return c.json({ success: false, error: "Failed to fetch agents" }, 500);
224}
225});
390return c.json({ success: true, data: inquiries });
391} catch (error) {
392console.error("Error fetching inquiries:", error);
393return c.json({ success: false, error: "Failed to fetch inquiries" }, 500);
394}
395});
402return c.json({ success: true, data: inquiries });
403} catch (error) {
404console.error("Error fetching user inquiries:", error);
405return c.json({ success: false, error: "Failed to fetch inquiries" }, 500);
406}
407});
529return c.json({ success: true, data: favorites });
530} catch (error) {
531console.error("Error fetching favorites:", error);
532return c.json({ success: false, error: "Failed to fetch favorites" }, 500);
533}
534});
561return c.json({ success: true, data: stats });
562} catch (error) {
563console.error("Error fetching dashboard stats:", error);
564return c.json({ success: false, error: "Failed to fetch dashboard stats" }, 500);
565}
566});
582583// This is the entry point for HTTP vals
584export default app.fetch;
untitled-3483index.ts1 match
221222// This is the entry point for HTTP vals
223export default app.fetch;
untitled-3483index.js1 match
700
701try {
702const response = await fetch(`/api/products?search=${encodeURIComponent(query)}`);
703const products = await response.json();
704