Skip to main content

Worked solution: Whose record is this?

This folder contains the runnable reference app. Read the instructor walkthrough for explanations and expected observations. Students should try the worksheet before opening this answer key.

From this solution folder, with Node 22 or newer:

node checks.mjs
node server.mjs

All checks should pass. Open http://127.0.0.1:3000 after starting the server. Stop any student server first, since both use port 3000. Ctrl+C stops the solution server.

The permission decision compares record.ownerId with user.id. Alex can read record 101, but not Sam's record 102. The rest of the runnable app matches the starter. The supplied fixed identity is not production authentication. Keep this app local and use only fictional data.

Screenshot preview