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
var isAuthenticatedHandler = function(mountPoint) { | |
return function(req, res, next) { | |
if (!req.session.username) { | |
res.redirect(mountPoint + '/login'); | |
} else { | |
next(); | |
} | |
} | |
}; |
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
var express = require("express") | |
, app = express() | |
, parentApp = express() | |
var isAuthenticatedHandler = function(req, res, next) { | |
if (!req.session.username) { | |
res.redirect('login'); | |
} else { | |
next(); | |
} |
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
exports.new = function(req, res){ | |
Colour.list({}, function(err,colours) { | |
res.render('cars/new', { | |
title: 'New Car', | |
event: new Car({}), | |
colours: colours | |
}) | |
}) | |
} |
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
// Assumes you've already somehow configured your db access. I left that part out | |
var mongoose = require("mongoose") | |
var es = new mongoose.Schema({ | |
'firstname': { type: String, required: true }, | |
'lastname': { type: String, required: true }, | |
'email': { type: String, required: true, index: { unique: true, sparse: true }, validate: /\b[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,4}\b/ }, | |
'departmentId': { type: mongoose.Schema.ObjectId, required: true }, | |
'enddate': String, |
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
{ __v: 0, _id: 511cea75f01700e675000001 } | |
/home/dev/source/bigoh/vapor/node_modules/mongoose/lib/utils.js:398 | |
throw err; | |
^ | |
AssertionError: null == true | |
at /home/dev/source/bigoh/vapor/noCustom.js:20:3 | |
at Promise.Model.create (/home/dev/source/bigoh/vapor/node_modules/mongoose/lib/model.js:1289:21) | |
at Promise.onResolve (/home/dev/source/bigoh/vapor/node_modules/mongoose/node_modules/mpromise/lib/promise.js:162:8) | |
at Promise.EventEmitter.emit (events.js:99:17) |
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
check ensure block | |
check ensure block | |
With no exception: good | |
With exception: bad | |
With exception and ensure: bad | |
With no exception and else: else |
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
; extensions.conf - the Asterisk dial plan | |
; | |
; Static extension configuration file, used by | |
; the pbx_config module. This is where you configure all your | |
; inbound and outbound calls in Asterisk. | |
; | |
; This configuration file is reloaded | |
; - With the "dialplan reload" command in the CLI | |
; - With the "reload" command (that reloads everything) in the CLI |
NewerOlder