API 401 AND 403 EXAMPLE

This is an invented local API, separate from TestAcademy graded problems.
It uses fixed demonstration tokens to show permission checks.
It does not implement a production sign-in system.
Use Node.js 22 or newer. No package installation is needed.
These tests run locally, outside the TestAcademy browser editor.

In a terminal in this folder:
  node server.mjs

Keep that terminal open. In another terminal in the same folder:
  node --test auth.test.mjs

The tests check missing credentials, an unknown token, reader access and writer access.
A reader can GET notes, but POST returns 403.
A writer can POST a note and receives 201.
The example notes are held in memory and disappear when the server stops.
Stop the server with Ctrl+C when finished.

If port 3041 is in use, stop the app using it or change the port in both files.
Do not send real passwords or tokens to this example server.
