123 }
124
125 const response = await fetch(endpoint, {
126 method: 'POST',
127 headers: { 'Content-Type': 'application/json' },
201 const method = isEditing ? 'PUT' : 'POST';
202
203 const response = await fetch(url, {
204 method,
205 headers: { 'Content-Type': 'application/json' },
1export async function checkLink(link) {
2 const linksMetaData = await fetch(link, {
3 method: "HEAD",
4 headers: {
100
101// This is the entry point for HTTP vals
102export default app.fetch;
163 const { content: url } = await c.req.json() as ParseRequest;
164
165 // Fetch the webpage content
166 const response = await fetch(url);
167 if (!response.ok) {
168 return c.json({ success: false, error: 'Failed to fetch URL' } as ParseResponse);
169 }
170
1export async function urlGetter(sourceURl) {
2 const response = await fetch(sourceURl);
3 const html = await response.text();
4 const matches = [...html.matchAll(/<a[^>]*href="([^"]+)"[^>]*>(.*?)<\/a>/g)].map((match) => match[1]);
25});
26
27export default app.fetch;
28Deno.serve(app.fetch);
34 const handleDelete = async () => {
35 try {
36 const response = await fetch(`/api/recipes/${recipe.id}`, {
37 method: 'DELETE'
38 });
48 const handleDelete = async (recipeId: number) => {
49 try {
50 const response = await fetch(`/api/recipes/${recipeId}`, {
51 method: 'DELETE'
52 });
33 setState(prev => ({ ...prev, loading: true, error: null }));
34 try {
35 const response = await fetch('/api/recipes');
36 const data = await response.json();
37
30 return c.json({ success: true, data: recipes } as ApiResponse<Recipe[]>);
31 } catch (error) {
32 console.error('Error fetching recipes:', error);
33 return c.json({ success: false, error: 'Failed to fetch recipes' } as ApiResponse, 500);
34 }
35});
50 return c.json({ success: true, data: recipe } as ApiResponse<Recipe>);
51 } catch (error) {
52 console.error('Error fetching recipe:', error);
53 return c.json({ success: false, error: 'Failed to fetch recipe' } as ApiResponse, 500);
54 }
55});