NOTE: this is a web programming class, please used php or Json.... if you can no
ID: 3804311 • Letter: N
Question
NOTE: this is a web programming class, please used php or Json.... if you can not do php or Json using anything you like all I need is the requirements and the website works ..... thanks In this project, you are required to develop a simple shopping website. You need to fulfill the following functionalities to earn credits. 1. User login function (15%) A json file stores a users information list. (5%) A web page requests and verifies the user's login information (id and password).(10%) 2. Item List (35%) A json file stores an item list, containing at least twenty items. (5%) A web page displays an item list (10%) A web page displays the item details.(10%) Search function, and a web page displays searching result (10%) 3. Shopping cart (10%) A web page displays current shopping cart (10%) 4. GUI design (40%) Extra Credit (20%) 1, Replace all json functions above by MysQL database 2, User registration function register new users, and add new users' information into databaseExplanation / Answer
var CT = require('./modules/country-list');
var AM = require('./modules/account-manager');
var EM = require('./modules/email-dispatcher');
module.exports = function(app) square measure saved in an exceedingly cookie //
if (req.cookies.user == indefinite || req.cookies.pass == undefined));
} elsetry automatic login //
AM.autoLogin(req.cookies.user, req.cookies.pass, function(o) else);
}
});
}
});
app.post('/', function(req, res) else);
res.cookie('pass', o.pass, );
}
res.status(200).send(o);
}
});
});
// logged-in user homepage //
app.get('/home', function(req, res) isn't logged-in send back to login page //
res.redirect('/');
} else);
}
});
app.post('/home', function(req, res) else, function(e, o) else{
req.session.user = o;
// update the user's login cookies if they exists //
if (req.cookies.user != indefinite && req.cookies.pass != undefined){
res.cookie('user', o.user, );
res.cookie('pass', o.pass, );
}
res.status(200).send('ok');
}
});
}
});
app.post('/logout', function(req, res));
})
// making new accounts //
app.get('/signup', function(req, res) );
});
app.post('/signup', function(req, res), function(e) else
});
});
// arcanum reset //
app.post('/lost-password', function(req, res)find the user's account via their email //
AM.getAccountByEmail(req.body['email'], function(o)recall takes a flash to come //
// TODO add associate Ajax loader to allow user feedback //
if (!e) else{
for (k in e) console.log('ERROR : ', k, e[k]);
res.status(400).send('unable to dispatch arcanum reset');
}
});
} else
});
});
app.get('/reset-password', function(req, res) volt-ampere email = req.query["e"];
power unit passH = req.query["p"];
AM.validateResetLink(email, passH, function(e) else{
// save the user's email in an exceedingly session rather than causing to the shopper //
req.session.reset = ;
res.render('reset', );
}
})
});
app.post('/reset-password', function(req, res) volt-ampere nPass = req.body['pass'];
// retrieve the user's email from the session to operation their account and reset arcanum //
power unit email = req.session.reset.email;
// destory the session instantly when retrieving the hold on email //
req.session.destroy();
AM.updatePassword(email, nPass, function(e, o){
if (o) else
})
});
// read & delete accounts //
app.get('/print', function(req, res) );
})
});
app.post('/delete', function(req, res));
} else
});
});
app.get('/reset', function(req, res) );
});
app.get('*', function(req, res) ); });
var CT = require('./modules/country-list');
var AM = require('./modules/account-manager');
var EM = require('./modules/email-dispatcher');
module.exports = function(app) square measure saved in an exceedingly cookie //
if (req.cookies.user == indefinite || req.cookies.pass == undefined));
} elsetry automatic login //
AM.autoLogin(req.cookies.user, req.cookies.pass, function(o) else);
}
});
}
});
app.post('/', function(req, res) else);
res.cookie('pass', o.pass, );
}
res.status(200).send(o);
}
});
});
// logged-in user homepage //
app.get('/home', function(req, res) isn't logged-in send back to login page //
res.redirect('/');
} else);
}
});
app.post('/home', function(req, res) else, function(e, o) else{
req.session.user = o;
// update the user's login cookies if they exists //
if (req.cookies.user != indefinite && req.cookies.pass != undefined){
res.cookie('user', o.user, );
res.cookie('pass', o.pass, );
}
res.status(200).send('ok');
}
});
}
});
app.post('/logout', function(req, res));
})
// making new accounts //
app.get('/signup', function(req, res) );
});
app.post('/signup', function(req, res), function(e) else
});
});
// arcanum reset //
app.post('/lost-password', function(req, res)find the user's account via their email //
AM.getAccountByEmail(req.body['email'], function(o)recall takes a flash to come //
// TODO add associate Ajax loader to allow user feedback //
if (!e) else{
for (k in e) console.log('ERROR : ', k, e[k]);
res.status(400).send('unable to dispatch arcanum reset');
}
});
} else
});
});
app.get('/reset-password', function(req, res) volt-ampere email = req.query["e"];
power unit passH = req.query["p"];
AM.validateResetLink(email, passH, function(e) else{
// save the user's email in an exceedingly session rather than causing to the shopper //
req.session.reset = ;
res.render('reset', );
}
})
});
app.post('/reset-password', function(req, res) volt-ampere nPass = req.body['pass'];
// retrieve the user's email from the session to operation their account and reset arcanum //
power unit email = req.session.reset.email;
// destory the session instantly when retrieving the hold on email //
req.session.destroy();
AM.updatePassword(email, nPass, function(e, o){
if (o) else
})
});
// read & delete accounts //
app.get('/print', function(req, res) );
})
});
app.post('/delete', function(req, res));
} else
});
});
app.get('/reset', function(req, res) );
});
app.get('*', function(req, res) ); });
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.