want to make 2 pages ,1 balance ,1 deposit .that i go into the 2 pages ,and i can do changes on the account in the json  like i go into the "balance "page ,select 1 account ,and i can add balance in it ,and save it to the json  how  can i made a nodejs app and webpage

Computer Networking: A Top-Down Approach (7th Edition)
7th Edition
ISBN:9780133594140
Author:James Kurose, Keith Ross
Publisher:James Kurose, Keith Ross
Chapter1: Computer Networks And The Internet
Section: Chapter Questions
Problem R1RQ: What is the difference between a host and an end system? List several different types of end...
icon
Related questions
Question

account.json 

"1000001": {
        "accountType": "Chequing",
        "accountBalance": 0
    },
    "1000002": {
        "accountType": "Savings",
        "accountBalance": 0
    },
    "1000011": {
        "accountType": "Chequing",
        "accountBalance": 0
    },
    "1000022": {
        "accountType": "Savings",
        "accountBalance": 0
    },
    "1000031": {
        "accountType": "Chequing",
        "accountBalance": 0
    },
    "1000032": {
        "accountType": "Savings",
        "accountBalance": 0
    },
    "1000051": {
        "accountType": "Chequing",
        "accountBalance": 13.699999999999989
    },
    "1000052": {
        "accountType": "Savings",
        "accountBalance": 0
    },
    "1000071": {
        "accountType": "Chequing",
        "accountBalance": 0
    },
    "1000081": {
        "accountType": "Savings",
        "accountBalance": 0
    },
    "1000091": {
        "accountType": "Chequing",
        "accountBalance": 0
    },
    "lastID": "1000091"
}

-------

var express = require('express');
var exphbs = require('express-handlebars');
var app = express();
//app.engine('.hbs', exphbs({extname: '.hbs'}));
//app.set('view engine', '.hbs');
app.engine('hbs', exphbs({defaultLayout: false, extname:'.hbs',}));
const bodyParser = require("body-parser");
const fs = require("fs");
var createError = require("http-errors");
const passport = require("passport");
var path = require("path");
const session = require("express-session");
var cookieParser = require("cookie-parser");
var logger = require("morgan");
var express = require('express');
var exphbs = require('express-handlebars');


app.set("views", path.join(__dirname, "views"));
app.set("view engine", "hbs");
app.use(logger("dev"));
app.use(express.json());
app.use(express.urlencoded({ extended: false }));
app.use(cookieParser());
app.use(express.static(path.join(__dirname, "public")));
app.use(express.static("./public"));
app.use(bodyParser.urlencoded({ extended: false }));
app.use(bodyParser.json());
var userLogin = {};

app.post("/api/login", (req, res) => {

    fs.readFile("./data.json", (err, data) => {
        var arr = [];
        if (err) {
        console.log(err);
        } else {
        if (data.toString()) {
        arr = JSON.parse(data.toString());
        }
        var s = arr.find((item) => {
        if (item.name == req.body.name) {
        return item;
        }
        });
        if (s) {
        if (s.password == req.body.password) {
        userLogin = req.body;
        res.json({
        status: "y",
        meg: "login success",
        data: s.name,
        });
        } else {
        res.json({
        status: "err",
        meg: "wrong password ",
        });
        }
        } else {
        res.json({
        status: "n",
        meg: "no such user ",
        });
    }
}
});

});

app.get("/index", (req, res) => {
    if (userLogin.name) {
        res.render("index", { username: userLogin.name });
    }
    
    else {
        res.render("login");
    }
});

 

 

app.post("/logout", (req, res) => {

    res.render('login', {
    });

});

 

 

app.post("/returnBank", (req, res) => {

    res.render('lndex', {
    });

});

app.post('/withdrawal', (req, res) => {

    
});

 

 

 

 

 

app.set("views", path.join(__dirname, "views"));

app.use(express.static(path.join(__dirname, "public")));

 

app.post("/back", (req, res) => {

    var someData = {
        user: req.MySession.user,
        accounts: userAccountsOnly
    };

    res.render('lndex', {
        data: someData
    });

});

 

 

var PORT = 3000;
app.listen(3000, function () {
console.log(`Listening on port ${PORT}`);
});

-------------------

i want to make 2 pages ,1 balance ,1 deposit .that i go into the 2 pages ,and i can do changes on the account in the json 

like i go into the "balance "page ,select 1 account ,and i can add balance in it ,and save it to the json 

how  can i made a nodejs app and webpage 

 

Expert Solution
steps

Step by step

Solved in 2 steps

Blurred answer
Recommended textbooks for you
Computer Networking: A Top-Down Approach (7th Edi…
Computer Networking: A Top-Down Approach (7th Edi…
Computer Engineering
ISBN:
9780133594140
Author:
James Kurose, Keith Ross
Publisher:
PEARSON
Computer Organization and Design MIPS Edition, Fi…
Computer Organization and Design MIPS Edition, Fi…
Computer Engineering
ISBN:
9780124077263
Author:
David A. Patterson, John L. Hennessy
Publisher:
Elsevier Science
Network+ Guide to Networks (MindTap Course List)
Network+ Guide to Networks (MindTap Course List)
Computer Engineering
ISBN:
9781337569330
Author:
Jill West, Tamara Dean, Jean Andrews
Publisher:
Cengage Learning
Concepts of Database Management
Concepts of Database Management
Computer Engineering
ISBN:
9781337093422
Author:
Joy L. Starks, Philip J. Pratt, Mary Z. Last
Publisher:
Cengage Learning
Prelude to Programming
Prelude to Programming
Computer Engineering
ISBN:
9780133750423
Author:
VENIT, Stewart
Publisher:
Pearson Education
Sc Business Data Communications and Networking, T…
Sc Business Data Communications and Networking, T…
Computer Engineering
ISBN:
9781119368830
Author:
FITZGERALD
Publisher:
WILEY