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
| warn: (to silence this warning, change `config/express.js`) | |
| /Users/henry/Documents/dev/node/hackerbracket/node_modules/sails-mongo/node_modules/mongodb/lib/mongodb/connection/base.js:242 | |
| throw message; | |
| ^ | |
| TypeError: Object #<ServerResponse> has no method 'notFound' | |
| at found (/Users/henry/Documents/dev/node/hackerbracket/node_modules/sails/lib/hooks/blueprints/actions/find.js:86:35) | |
| at bound (/Users/henry/Documents/dev/node/hackerbracket/node_modules/lodash/dist/lodash.js:957:21) | |
| at applyInOriginalCtx (/Users/henry/Documents/dev/node/hackerbracket/node_modules/sails/node_modules/waterline/lib/waterline/utils/normalize.js:362:80) |
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
| show: function (req, res, next){ | |
| Hacks.findOne(req.param('id'), function foundHack(err, hack){ | |
| if(err) return next(err); | |
| if (!hack) return next(); | |
| User.findOne(hack.owner, function foundUser(err, user){ | |
| if(err) return next(err); | |
| if (!user) return next(); | |
| Comment.find({postID: hack.id}).sort('createdAt ASC').exec(function foundHack(err, comment){ | |
| if(err) return next(err); | |
| if (!comment) return next(); |
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
| module.exports = { | |
| port: process.env.PORT || 1337, | |
| environment: process.env.NODE_ENV || 'development', | |
| adparters: { | |
| 'default': 'mongo', | |
| mongo: { |
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
| if (environment === 'development') { db_connection = { | |
| module : 'sails-mongo', | |
| url: process.env.DB_URL, | |
| schema: true | |
| }} else if (environment === 'production'){ db_connection = { | |
| module: 'sails-mongo', | |
| url: 'mongodb://1hackerbracket1:paulhenry1@candidate.12.mongolayer.com:10479/hackerbracket', |
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
| /** | |
| * Bootstrap | |
| * | |
| * An asynchronous boostrap function that runs before your Sails app gets lifted. | |
| * This gives you an opportunity to set up your data model, run jobs, or perform some special logic. | |
| * | |
| * For more information on bootstrapping your app, check out: | |
| * http://sailsjs.org/#documentation | |
| */ |
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
| /** | |
| * Bootstrap | |
| * (sails.config.bootstrap) | |
| * | |
| * An asynchronous bootstrap function that runs before your Sails app gets lifted. | |
| * This gives you an opportunity to set up your data model, run jobs, or perform some special logic. | |
| * | |
| * For more information on bootstrapping your app, check out: | |
| * http://links.sailsjs.org/docs/config/bootstrap | |
| */ |
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
| console.log(process.env.NODE_ENV); | |
| if (process.env.NODE_ENV === 'development') { db_connection = { | |
| module : 'sails-mongo', | |
| url: process.env.DB_URL, | |
| schema: true | |
| }} else if (process.env.NODE_ENV === 'production'){ db_connection = { |
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
| Comment.find() | |
| .where({ postID: hackID }) | |
| .exec(function(err, comments){ | |
| if(err) return next(err); | |
| if (!comments) return next(); | |
| var hackOwner = hacks.map(function(item){ return item.owner }); | |
| User.find() | |
| .where({ id: hackOwner }) | |
| .exec(function(err, users){ |
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.controller('Session', function ($scope, $http) { | |
| $scope.title = "HackerBracket"; | |
| $scope.user = {}; | |
| $scope.init = function () {}; | |
| $scope.login = function () { | |
| var url = '/api/login'; | |
| $http.post(url, $scope.user).success(function (data, status, headers, config) { | |
| console.log(data); | |
| console.log('success'); | |
| window.location = '/'+data.user.username; |
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
| 'GET /api/notifications': 'NotificationController.show', | |
| 'GET /api/hacks/recent': 'HacksController.recent', | |
| 'GET /api/hacks/recent/:id': 'HacksController.recent', | |
| 'GET /api/hacks/popular': 'HacksController.popular', | |
| 'GET /api/hacks/following': 'HacksController.following', |