i have this simple app.js using express JS\NODEJS
var express= require("express");
var path= require("path");
var app= express();
app.use(express.static(__dirname));
var users=[ { userName: "faizan", password: "faizan", email: "[email protected]"},
{ userName: "ali", password: "ali", email: "[email protected]"},
{ userName: "hussain", password: "hussain", email: "[email protected]"},
{ userName: "hassan", password: "hassan", email: "[email protected]"},
];
app.get('/',function(request , response){
response.sendFile(__dirname+ '/index.html');
});
app.get('/frmSignUp', function(request, response){
users.push({
userName: request.query["userName"],
password: request.query["password"],
email: request.query["email"]
});
response.sendFile(__dirname+ '/dashboard.html');
//how can i show my user array items in my dashboard html page?? Question1
});
app.get('/frmSignIn',function(request, response)
{
if(users.contains(request.query["userName"])) //this is invalid
// is there any way available to check userName in array that is this exists?
response.sendFile(__dirname+ '/dashboard.html');
})
var server =app.listen(3010, function(){
console.log("server running on port "+ server.address().port);
})
i have index SignUp SignIn and Dashboard HTML pages in root directory. i have question which are commented in above code please let me know is these thing possible for me to do??