This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
export default async (event, context) => { | |
return new Response(JSON.stringify({ message: 'Hello World' }), { | |
headers: { | |
'content-type': 'application/json', | |
'Netlify-Cache-ID': 'productID-1,products'// Set your custom cache IDs here | |
} | |
}); | |
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { lazy, Suspense } from 'react'; | |
const ProductDetails = lazy(() => import('./ProductDetails')); | |
function ProductListing({ products }) { | |
return ( | |
<Suspense fallback={<div>Loading...</div>}> | |
<ul> | |
{products.map((product) => ( | |
<li key={product.id}> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React, { useState, useEffect } from 'react'; | |
const ImageLoader = ({ src, alt, placeholder }) => { | |
const [imageSrc, setImageSrc] = useState(placeholder || src); | |
useEffect(() => { | |
const img = new Image(); | |
img.src = src; | |
img.onload = () => setImageSrc(src); | |
}, [src]); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
export default async (req) => { | |
const { next_run } = await req.json() | |
// Fetch the latest blog posts | |
const response = await fetch(`https://mysite.com/api/blog-posts`); | |
const blogPosts = await response.json(); | |
// Compile email content | |
for (const blogPost of blogPosts) { | |
emailContent += ` | |
<h2>${blogPost.title}</h2> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- Supabase AI is experimental and may produce incorrect answers | |
-- Always verify the output before executing | |
create | |
or replace function vector_search ( | |
query_embedding vector (1536), | |
similarity_threshold float, | |
match_count int | |
) returns table ( |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[ | |
{ | |
first_name: 'Elon', | |
last_name: 'Musk', | |
image: | |
'https://c4.wallpaperflare.com/wallpaper/1012/124/930/men-elon-musk-wallpaper-preview.jpg', | |
age: 50, | |
email: '[email protected]', | |
address: { | |
street: 'SpaceX Blvd', |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { builder } from '@netlify/functions'; | |
import { fetch } from 'node-fetch'; | |
async function handler(event, context) { | |
// Get the product ID from URL path | |
const segments = event.path.split('/'); | |
const productId = segments[segments.length - 1]; | |
// Fetch the product price from the API | |
const response = await fetch(`https://api.example.com/products/${productId}`); | |
const price = await response.json(); | |
// Generate the pricing table |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { builder } from "@netlify/functions"; | |
const myHandler = async (event, context) => { | |
const segments = event.path.split('/'); | |
const name = segments[segments.length - 1]; | |
console.log(name); | |
const greeting = name ? `Hello ${name}` : 'Hello World'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const state = { | |
currentPage: window.location.pathname, | |
search: { | |
term: '', | |
type: '', | |
page: 1, | |
totalPages: 1, | |
totalResults: 0, | |
}, | |
api: { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
.container { | |
font-family: "Poppins", sans-serif; | |
display: flex; | |
padding: 2rem 5rem; | |
align-items: center; | |
justify-content: space-between; | |
@media screen and (max-width: 1000px) { | |
padding: 2rem 3rem; | |
} |
NewerOlder