Install diskDB

Run the following in the project folder to install diskdb:

npm install diskdb

Create a users.json file at the root of the project directory to serve as our database collection where we have our users' details.

Populate users.json with the following:

[{"name": "Marcel", "email": "", "phone_number":"08012345", "isOnline":false}]

Now, update route.js.

route.jsconst express = require('express');const router = express.Router();const db = require('diskdb');db.connect(__dirname, ['users']);//'/users', function(req, res, next) {var user = req.body;if (! && !( + '') && !(user.phone_number + '') && !(user.isActive + '')) {res.status(400);res.json({error: 'error'});} else {console.log('ds'); ...

Get TypeScript 2.x for Angular Developers now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.