svgRendererideaScore-renderer.ts3 matches
34export const handler = {
5async fetch(req: Request) {
6// IdeaScore logo SVG code - Using standard SVG attribute naming with dashes
7const svg = `<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 301 113.266" width="301" height="113.266">
67};
6869// Export the fetch handler for Val Town
70export default handler.fetch;
34export const handler = {
5async fetch(req: Request) {
6// Instagram logo SVG code with green gradient
7const svg = `<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512" width="512" height="512">
49};
5051// Export the fetch handler for Val Town
52export default handler.fetch;
mynewprojectjxnReactStream4 matches
67export type RequestHandler = (request: Request) => Promise<Response>;
8export type DataFetcher<T> = (request: Request) => Promise<T>;
910// export type DataRequest<T> = Request & { data: T };
132return api(req);
133};
134const deprecatedGetInitiaProps = (getProps: DataFetcher<any>): Middleware => async (req, res, next) => {
135if (!getProps) return next();
136const data = await getProps(req);
144/** DEPRECATED: Optional API request handler for all non-GET methods */
145api?: RequestHandler;
146/** DEPRECATED: data fetcher to set initial props based on request */
147getInitialProps?: DataFetcher<any>;
148}
openTownieMadeThis1index.ts2 matches
1import { Hono } from "https://esm.sh/hono@3.12.6";
2import { readFile, serveFile } from "https://esm.town/v/std/utils@71-main/index.ts";
3import { reloadOnSaveFetchMiddleware, currentProjectRef } from "https://esm.town/v/charmaine/reloadOnSaveProject/reloadOnSaveProject.ts";
45const app = new Hono();
5253// This is the entry point for HTTP vals
54export default reloadOnSaveFetchMiddleware(app.fetch);
openTownieMadeThis1index.js6 matches
74
75try {
76const response = await fetch('/api/hotels');
77const hotels = await response.json();
78
90alert('Hotel search results would display here in a real implementation');
91} catch (error) {
92console.error('Error fetching hotels:', error);
93}
94});
102getOfferDetailsBtn.addEventListener('click', async () => {
103try {
104const response = await fetch('/api/offers');
105const offers = await response.json();
106const mainOffer = offers[0]; // Get the first offer (Anniversary offer)
108alert(`Offer Details: ${mainOffer.title}\n\n${mainOffer.details}`);
109} catch (error) {
110console.error('Error fetching offer details:', error);
111}
112});
114viewAllOffersBtn.addEventListener('click', async () => {
115try {
116const response = await fetch('/api/offers');
117const offers = await response.json();
118
120alert(`All Available Offers:\n\n${offersList}`);
121} catch (error) {
122console.error('Error fetching all offers:', error);
123}
124});
svgRenderersvgRenderer.ts3 matches
36*/
37export const handler = {
38async fetch(req: Request) {
39// Get the SVG content from the request query parameters
40const url = new URL(req.url);
64};
6566// Export the default fetch handler
67export default handler.fetch;
OpenTowniesystem_prompt.txt5 matches
71```
72735. **fetchTranspiledJavaScript** - Fetch and transpile TypeScript to JavaScript:
74```ts
75const jsCode = await fetchTranspiledJavaScript("https://esm.town/v/username/project/path/to/file.ts");
76```
77200
201// Inject data to avoid extra round-trips
202const initialData = await fetchInitialData();
203const dataScript = `<script>
204window.__INITIAL_DATA__ = ${JSON.stringify(initialData)};
2582595. **API Design:**
260- `fetch` handler is the entry point for HTTP vals
261- Run the Hono app with `export default app.fetch // This is the entry point for HTTP vals`
262- Properly handle CORS if needed for external access
OpenTownieCreateBranch.tsx1 match
43
44try {
45const response = await fetch("/api/create-branch", {
46method: "POST",
47headers: {
OpenTownieBranchControl.tsx22 matches
30const [showCreateBranch, setShowCreateBranch] = useState<boolean>(false);
3132// Fetch branches when project changes
33useEffect(() => {
34if (!projectId) return;
3536const fetchBranches = async () => {
37setIsLoadingBranches(true);
38try {
39const response = await fetch(`/api/project-branches?projectId=${projectId}`, {
40headers: {
41"Authorization": `Bearer ${bearerToken}`,
4445if (!response.ok) {
46throw new Error(`Failed to fetch branches: ${response.statusText}`);
47}
4849const data = await response.json();
50const fetchedBranches = data.branches || [];
51setBranches(fetchedBranches);
5253// Check if the stored branchId is valid for this project
54const storedBranchIsValid = fetchedBranches.some((branch: Branch) => branch.id === branchId);
5556// Only set a new branchId if there isn't a valid one already stored
57if (!storedBranchIsValid && fetchedBranches.length > 0) {
58// If branches are loaded and there's a "main" branch, select it by default
59const mainBranch = fetchedBranches.find((branch: Branch) => branch.name === "main");
60if (mainBranch) {
61setBranchId(mainBranch.id);
63} else {
64// Otherwise select the first branch
65setBranchId(fetchedBranches[0].id);
66setSelectedBranchName(fetchedBranches[0].name);
67}
68} else if (storedBranchIsValid) {
69// Set the selected branch name based on the stored branchId
70const selectedBranch = fetchedBranches.find((branch: Branch) => branch.id === branchId);
71if (selectedBranch) {
72setSelectedBranchName(selectedBranch.name);
74}
75} catch (error) {
76console.error("Error fetching branches:", error);
77} finally {
78setIsLoadingBranches(false);
80};
8182fetchBranches();
83}, [projectId, bearerToken, branchId, setBranchId]);
84105// Refresh the branches list
106if (projectId) {
107const fetchBranches = async () => {
108try {
109const response = await fetch(`/api/project-branches?projectId=${projectId}`, {
110headers: {
111"Authorization": `Bearer ${bearerToken}`,
114115if (!response.ok) {
116throw new Error(`Failed to fetch branches: ${response.statusText}`);
117}
118119const data = await response.json();
120const fetchedBranches = data.branches || [];
121setBranches(fetchedBranches);
122123// Update the selected branch name
124const selectedBranch = fetchedBranches.find((branch: Branch) => branch.id === newBranchId);
125if (selectedBranch) {
126setSelectedBranchName(selectedBranch.name);
127}
128} catch (error) {
129console.error("Error fetching branches:", error);
130}
131};
132133fetchBranches();
134}
135};
md_crawlcrawler.ts.fixed2 matches
70): Promise<CrawlResult> {
71try {
72const response = await fetch(url, {
73headers: {
74'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/91.0.4472.124 Safari/537.36'
77
78if (!response.ok) {
79throw new Error(`Failed to fetch ${url}: ${response.status} ${response.statusText}`);
80}
81