Creating the controller's files
Now let's create the controller's files in server/controllers
:
- Create a file called
auth.js
and add the following code:// get gravatar icon from email var gravatar = require('gravatar'); var passport = require('passport'); // Signin GET exports.signin = function(req, res) { // List all Users and sort by Date res.render('login', { title: 'Login Page', message: req.flash('loginMessage') }); }; // Signup GET exports.signup = function(req, res) { // List all Users and sort by Date res.render('signup', { title: 'Signup Page', message: req.flash('signupMessage') }); }; // Profile GET exports.profile = function(req, res) { // List all Users and sort by Date res.render('profile', { title: 'Profile Page', user : req.user, ...
Get Node.js 6.x Blueprints now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.