Solution 1 :

The issue here is that node-localstorage is entirely backend, and htlm5 localStorage is entirely client side. You will not be able to pull backend values set with node-localstorage on the client end.

In order to pass values from node to the client you will need a template engine. Express provides a pretty complete list of those engines here:

Problem :

There are two files: 1)app.js and 2) browser.html. app.js just stores a value in a node-js local storage and browser.html should alerts that. But browser.html alerts “null”.
My JavaScript code:

var LocalStorage = require('node-localstorage').LocalStorage;
    localStorage = new LocalStorage('./scratch');
var a="salam";

My html code:

<!DOCTYPE html>
<html lang="en">
<input value="Smart contract data" max="25" id="12"></input>
    <script src='js/app.js'>  </script>

What is the problem and its solution? Is there any way to communicate between node-js storage and a html file? Please guide a beginner man.


Comment posted by Jozott

Do u want to run a node js server and the user should see the html page when he visits the site?

Comment posted by Alireza

Yes, that is true

Comment posted by Alireza

Thanks. Is it any different to choose one of these engines?