This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
.when('/profile', { | |
templateUrl: '/views/profile.html', | |
controller: 'ProfileController' | |
}) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<div class="page-header text-center"> | |
<h1><span class="fa fa-anchor"></span> Profile Page</h1> | |
<a logout href="/logout" class="btn btn-default btn-sm">Logout</a> | |
</div> | |
<div class="row"> | |
<!-- LOCAL INFORMATION --> | |
<div class="col-sm-12"> | |
<div class="well"> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
app.post('/signup', function(req, res, next) { | |
// if email or password is missing, return an error message | |
if (!req.body.email || !req.body.password) { | |
return res.status(400).json({ error: 'Email and Password required' }); | |
} | |
passport.authenticate('local-signup', function(err, user, info) { | |
if (err) { | |
return res.status(400).json(err); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(function() { | |
angular.module('app') | |
.controller('LoginController', ['$http', '$location', | |
function($http, $location) { | |
var vm = this; | |
vm.login = function() { | |
$http | |
.post('/login', { | |
email: vm.email, | |
password: vm.password |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(function() { | |
angular.module('app') | |
.controller('SignupController', ['$http', '$location', | |
function($http, $location) { | |
var vm = this; | |
vm.signup = function() { | |
$http | |
.post('/signup', { | |
email: vm.email, | |
password: vm.password |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<div class="col-sm-6 col-sm-offset-3"> | |
<h1><span class="fa fa-sign-in"></span> Signup</h1> | |
<!-- SIGNUP FORM --> | |
<form ng-submit="signup.signup()" ng-controller="SignupController as signup"> | |
<div class="form-group"> | |
<label>Email</label> | |
<input type="text" class="form-control" ng-model="signup.email"> | |
</div> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<div class="col-sm-6 col-sm-offset-3"> | |
<h1><span class="fa fa-sign-in"></span> Login</h1> | |
<!-- LOGIN FORM --> | |
<form ng-submit="login.login()" ng-controller="LoginControllerTwo as login"> | |
<div class="form-group"> | |
<label>Email</label> | |
<input type="text" class="form-control" ng-model="login.email"> | |
</div> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// defining our routes | |
(function() { | |
angular.module('app') | |
.config(['$routeProvider', '$locationProvider', function($routeProvider, $locationProvider) { | |
$routeProvider | |
.when('/', { | |
templateUrl: '/views/landing.html', | |
}) | |
.when('/login', { | |
templateUrl: '/views/login.html', |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// server.js | |
... | |
app.use(express.static(path.join(__dirname, '/public'))); //Expose /public | |
// routes ====================================================================== | |
require('./app/routes.js')(app, passport); // load our routes and pass in our app and fully configured passport | |
// catch all other routes and have index.html handle them. | |
app.get('*', function (req, res){ | |
res.sendFile(path.join(__dirname+ '/public/views/index.html')); | |
}); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// defining our angular app, the first arguement is the name of our application | |
// second argument is an array that loads the dependencies into the application | |
(function() { | |
angular.module('app', ['ngRoute']); | |
})(); |