From 0d0727231af0b0a7ac0d934dcb2355ac7daa26a9 Mon Sep 17 00:00:00 2001 From: Chris Sevilleja Date: Sat, 18 Jan 2014 12:14:11 -0800 Subject: [PATCH] added mongodb and config --- config/db.js | 3 +++ package.json | 3 ++- public/css/style.css | 1 + public/index.html | 19 ++++++++++++++++--- public/js/appRoutes.js | 8 ++++---- public/js/controllers/NerdCtrl.js | 1 - server.js | 10 ++++++++-- 7 files changed, 34 insertions(+), 11 deletions(-) create mode 100644 config/db.js diff --git a/config/db.js b/config/db.js new file mode 100644 index 0000000..fcddeaf --- /dev/null +++ b/config/db.js @@ -0,0 +1,3 @@ +module.exports = { + url : 'mongodb://:@mongo.onmodulus.net:27017/uw45mypu' +} \ No newline at end of file diff --git a/package.json b/package.json index bea7d1b..8e215ca 100644 --- a/package.json +++ b/package.json @@ -2,6 +2,7 @@ "name": "starter-node-angular", "main": "server.js", "dependencies": { - "express": "latest" + "express": "latest", + "mongoose": "latest" } } diff --git a/public/css/style.css b/public/css/style.css index e69de29..525a5fa 100644 --- a/public/css/style.css +++ b/public/css/style.css @@ -0,0 +1 @@ +body { padding-top:30px; } \ No newline at end of file diff --git a/public/index.html b/public/index.html index 6d2f534..bb1b63b 100644 --- a/public/index.html +++ b/public/index.html @@ -3,13 +3,14 @@ - + Starter Node and Angular + @@ -24,10 +25,22 @@ +
+ + + - look at me - +
+
\ No newline at end of file diff --git a/public/js/appRoutes.js b/public/js/appRoutes.js index d13bceb..0c0ac35 100644 --- a/public/js/appRoutes.js +++ b/public/js/appRoutes.js @@ -8,13 +8,13 @@ angular.module('appRoutes', []).config(['$routeProvider', '$locationProvider', f }) // sample page 1 - .when('/sample1', { - templateUrl: 'views/sample1.html' + .when('/nerds', { + templateUrl: 'views/nerd.html' }) // sample page 2 (with parameters) - .when('/sample2:nerd_id', { - templateUrl: 'views/sample2.html' + .when('/test:name', { + templateUrl: 'views/nerd.html' }); $locationProvider.html5Mode(true); diff --git a/public/js/controllers/NerdCtrl.js b/public/js/controllers/NerdCtrl.js index a95e98b..0d2fa98 100644 --- a/public/js/controllers/NerdCtrl.js +++ b/public/js/controllers/NerdCtrl.js @@ -1,6 +1,5 @@ angular.module('NerdCtrl', []).controller('NerdController', function($scope) { $scope.test = 'hello'; - console.log('fuck'); }); \ No newline at end of file diff --git a/server.js b/server.js index 3c94419..482b1c1 100644 --- a/server.js +++ b/server.js @@ -1,9 +1,15 @@ // modules ================================================= var express = require('express'); var app = express(); +var mongoose= require('mongoose'); // configuration =========================================== -var port = process.env.PORT || 8080; + +// config files +var db = require('./config/db'); + +var port = process.env.PORT || 8080; // set our port +// mongoose.connect(db.url); // connect to our mongoDB database app.configure(function() { app.use(express.static(__dirname + '/public')); // set the static files location /public/img will be /img for users @@ -13,7 +19,7 @@ app.configure(function() { }); // routes ================================================== -require('./app/routes')(app); +require('./app/routes')(app); // pass our application into our routes // start app =============================================== app.listen(port);