Connecting to Taffy DB in Nodejs

962 views Asked by At

I am building an application using Angular js,Node js and Taffy DB.

I am trying to store the data submitted from front-end to Taffy DB through Node js server.

var express = require('express');
var TAFFY = require('taffy');
var teamlist=TAFFY();
exports.postShareData=function(data,response){   
console.log(data);
teamlist.store();
teamlist.insert(data);
console.log(teamlist); 
}

But I get "localStorage is not defined".

What may be the problem?How to rectify it.

Please Advice

1

There are 1 answers

0
Claies On

localStorage is a feature provided by the web browser. In node.js it doesn't exist. Which means if you reference localStorage in a script ran by node.js you will get errors.

you can use npm install localstorage and then var localStorage = require('localStorage') to satisfy the requirement