Two routes in our app return 404 in production on purpose, and they are how every card image gets made
Nearly every practice card on CogniPrep's public pages shows a still of the thing in play. The SHL hub has one per test, and the numerical reasoning format page reuses the same images across providers. They are not mockups and they are not hand-built. They are browser screenshots of the real screens. Which raises a problem. The real screens need a signed-in account with the right entitlements,…
Two routes within the app deliberately return a 404 error in production, serving as the basis for generating each card image. These routes are employed only on a developer's machine, bypassing the need for sign-in and authentication. When the application is built in production, the pages return a 404 status code, refusing to render.
The sibling route for assessment centre exercises follows a similar pattern, with the notable difference being that the exercise runner accepts the entire exercise as a prop, eliminating the need for an additional API route. The notFound() function provides clarity regarding the page's purpose, indicating that it is not intended for indexing.
The arithmetic behind the crop settings is designed to ensure whole regions without any cropping. The crop settings for games and exercises are tailored to their respective content, with a 16:10 aspect ratio maintained for optimal display. The resulting PNG images are resized to a lower resolution before being used, ensuring compatibility and reducing file size.
A manifest file is generated to keep track of the captured images, allowing the card component to determine whether an image exists before rendering it. This process ensures that cards can access valid images, maintaining the overall functionality and appearance of the application.
Written by urgent.news from Dev.to's reporting — not their text. Machine-written — may contain errors; check the original before relying on it.