jmak
jmak
CDCloudflare Developers
Created by jmak on 9/11/2023 in #pages-help
Need help building application with SSR.
I am getting a 500 error though...
9 replies
CDCloudflare Developers
Created by jmak on 9/11/2023 in #pages-help
Need help building application with SSR.
Yes, I have something like this:
const ImageCardPage = ({exploreImage}) => {
const router = useRouter();
const {id} = router.query;

const isMobile = useMediaQuery(theme.breakpoints.down('sm'));

const handleModalClose = () => {
router.push('/');
};

console.log("NEXT API URL: ", process.env.NEXT_PUBLIC_API_URL)
console.log("EXPLORE IMAGE: ", exploreImage)


return (
isMobile ? <MobileDetailedImageCard
exploreImageId={id}
exploreImage={exploreImage}
closeModal={handleModalClose}
/> :
<DetailedImageCard
exploreImageId={id}
exploreImage={exploreImage}
closeModal={handleModalClose}
/>
);
}

export default ImageCardPage;

export async function getServerSideProps({params}) {
const imageData = await exploreService.getExploreImage(params.id);
return {
props: {
exploreImage: imageData
}
};
}

export const runtime = 'experimental-edge';
const ImageCardPage = ({exploreImage}) => {
const router = useRouter();
const {id} = router.query;

const isMobile = useMediaQuery(theme.breakpoints.down('sm'));

const handleModalClose = () => {
router.push('/');
};

console.log("NEXT API URL: ", process.env.NEXT_PUBLIC_API_URL)
console.log("EXPLORE IMAGE: ", exploreImage)


return (
isMobile ? <MobileDetailedImageCard
exploreImageId={id}
exploreImage={exploreImage}
closeModal={handleModalClose}
/> :
<DetailedImageCard
exploreImageId={id}
exploreImage={exploreImage}
closeModal={handleModalClose}
/>
);
}

export default ImageCardPage;

export async function getServerSideProps({params}) {
const imageData = await exploreService.getExploreImage(params.id);
return {
props: {
exploreImage: imageData
}
};
}

export const runtime = 'experimental-edge';
9 replies
CDCloudflare Developers
Created by jmak on 9/11/2023 in #pages-help
Need help building application with SSR.
Github repo is currently private, but I think it's supposed to be something with edge runtime and dynamic routing
9 replies