Running the Notes application with filesystem storage

In package.json, add this to the scripts section:

"start-fs": "DEBUG=notes:* NOTES_MODEL=fs node --experimental-modules ./bin/www.mjs", 
When you put these entries in package.json, make sure that you use correct JSON syntax. In particular, if you leave a comma at the end of the scripts section, it will fail to parse and npm will throw up an error message.

With this code in place, we can now run the Notes application as follows:

$ DEBUG=notes:* npm run start-fs
    
> notes@0.0.0 start-fs /Users/david/chap07/notes
> NOTES_MODEL=models/notes-fs node --experimental-modules./bin/www.mjs
    
  notes:server Listening on port 3000 +0ms
  notes:fs-model keylist dir=notes-fs-data files=[  ] +4s  

Then we can ...

Get Node.js Web Development - Fourth Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.