This file contains 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
<protocol>//<hostname>:<port>/<pathname><search><hash> | |
Protocol -- Specifies the protocol name be used to access the resource on the Internet. (HTTP (without SSL) or HTTPS (with SSL)) | |
hostname -- Host name specifies the host that owns the resource. For example, www.stackoverflow.com. A server provides services using the name of the host. | |
port -- A port number used to recognize a specific process to which an Internet or other network message is to be forwarded when it arrives at a server. | |
pathname -- The path gives info about the specific resource within the host that the Web client wants to access. For example, /index.html. | |
query -- A query string follows the path component, and provides a string of information that the resource can utilize for some purpose (for example, as parameters for a search or as data to be processed). | |
hash -- The anchor portion of a URL, includes the hash sign (#). | |
With these Location object properties you can access all of these URL components |
This file contains 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
const mongoose = require('mongoose'); | |
const Schema = mongoose.Schema; | |
mongoose.Promise = global.Promise; | |
const passportLocalMongoose = require('passport-local-mongoose'); | |
const userSchema = new Schema({ | |
email: { | |
type: String, | |
unique: true, | |
lowercase: true, |
This file contains 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
const passport = require('passport'); | |
const crypto = require('crypto'); | |
const mongoose = require('mongoose'); | |
const User = mongoose.model('User'); | |
const promisify = require('es6-promisify'); | |
exports.login = passport.authenticate('local', { | |
failureRedirect: '/login', | |
failureFlash: 'Failed Login!', | |
successRedirect: '/', |