A REST server for user information

We are building our way towards integrating user information and authentication into the Notes application. The next step is to wrap the user data model we just created into a REST server. After that, we'll create a couple of scripts so that we can add some users, perform other administrative tasks, and generally verify that the service works. Finally, we'll extend the Notes application with login and logout support.

In the package.json file, change the main tag to the following line of code:

 "main": "user-server.mjs", 

Then create a file named user-server.mjs, containing the following code:

import restify from 'restify';import util from 'util';import DBG from 'debug';const log = DBG('users:service');  ...

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.