From 5a66568ede98fddcb97431e807f4beaf19017193 Mon Sep 17 00:00:00 2001 From: Jonnie Spratley Date: Sat, 10 Jan 2015 16:20:49 -0800 Subject: [PATCH] updated server --- npm-debug.log | 26 ++++++++++++++++++++++++++ routes/cms-db.js | 35 +++++++++++++++++++++++++++++++++++ www/register.ejs | 43 +++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 104 insertions(+) create mode 100644 npm-debug.log create mode 100644 routes/cms-db.js create mode 100644 www/register.ejs diff --git a/npm-debug.log b/npm-debug.log new file mode 100644 index 0000000..26cc712 --- /dev/null +++ b/npm-debug.log @@ -0,0 +1,26 @@ +0 info it worked if it ends with ok +1 verbose cli [ 'node', '/usr/local/bin/npm', 'start' ] +2 info using npm@1.4.21 +3 info using node@v0.10.30 +4 verbose run-script [ 'prestart', 'start', 'poststart' ] +5 info prestart angular-cms@0.0.1 +6 info start angular-cms@0.0.1 +7 verbose unsafe-perm in lifecycle true +8 info angular-cms@0.0.1 Failed to exec start script +9 error angular-cms@0.0.1 start: `node server.js` +9 error Exit status 8 +10 error Failed at the angular-cms@0.0.1 start script. +10 error This is most likely a problem with the angular-cms package, +10 error not with npm itself. +10 error Tell the author that this fails on your system: +10 error node server.js +10 error You can get their info via: +10 error npm owner ls angular-cms +10 error There is likely additional logging output above. +11 error System Darwin 14.0.0 +12 error command "node" "/usr/local/bin/npm" "start" +13 error cwd /WWW/Learning_Yeoman/angular-cms +14 error node -v v0.10.30 +15 error npm -v 1.4.21 +16 error code ELIFECYCLE +17 verbose exit [ 1, true ] diff --git a/routes/cms-db.js b/routes/cms-db.js new file mode 100644 index 0000000..8627df6 --- /dev/null +++ b/routes/cms-db.js @@ -0,0 +1,35 @@ +var mongoose = require('mongoose'); + +module.exports = function(config) { + console.warn('cms-db initialized'); + try { + mongoose.connect(config.db.url); + } catch (err) { + throw new Error('Unable to connect to MongoDB at ' + config.db.url); + } + + // CONNECTION EVENTS + // When successfully connected + mongoose.connection.on('connected', function() { + console.log('Mongoose default connection open to ', config.db.url); + }); + + // If the connection throws an error + mongoose.connection.on('error', function(err) { + console.log('Mongoose default connection error: ' + err); + }); + + // When the connection is disconnected + mongoose.connection.on('disconnected', function() { + console.log('Mongoose default connection disconnected'); + }); + + // If the Node process ends, close the Mongoose connection + process.on('SIGINT', function() { + mongoose.connection.close(function() { + console.log('Mongoose default connection disconnected through app termination'); + process.exit(0); + }); + }); + +}; \ No newline at end of file diff --git a/www/register.ejs b/www/register.ejs new file mode 100644 index 0000000..036c384 --- /dev/null +++ b/www/register.ejs @@ -0,0 +1,43 @@ + +<% layout('layout') -%> +
+
+
+ +
+ +
+
+ +
+
+ +
+
+ +
+
+ +
+
+ +
+
+ +
+
+
+ Back to Login +
+
+ +
\ No newline at end of file