Skip to content

Instantly share code, notes, and snippets.

View henryboldi's full-sized avatar
🐶

Henry Boldizsar henryboldi

🐶
View GitHub Profile
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)
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();
module.exports = {
port: process.env.PORT || 1337,
environment: process.env.NODE_ENV || 'development',
adparters: {
'default': 'mongo',
mongo: {
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:[email protected]:10479/hackerbracket',
/**
* 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
*/
/**
* 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
*/
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 = {
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){
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;
'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',