Public
Like
getNextSSR
Val Town is a collaborative website to build and scale JavaScript apps.
Deploy APIs, crons, & store data – all from the browser, and deployed in milliseconds.
Many modern websites use Next.js and Server-side Rendering (SSR) to serve their website and the data to populate it. Instead of standard API calls, this manifests in the browser as calls routed through dynamic endpoints.
This val handles the url construction and response parsing, giving you access to the endpoint and data.
- websiteUrl - The website's url, like
google.com
orval.town
let getNextSSR: (websiteUrl: string) => Promise<(endpoint: string) => Promise<Record<string, any>>>
- fetching function - A function that takes in an endpoint and returns the endpoint's response data:
-
- Input
-
- endpoint - The endpoint string, like
results.json
ortrending.json?page=2
- endpoint - The endpoint string, like
-
- Returns
-
- data - The endpoint response data, without NextJS artifacts.
const fetch = await @rlesser.getNextSSR("example.com");
const data = fetch("results.json");
return data;
Migrated from folder: utils/getNextSSR