Skip to content

Instantly share code, notes, and snippets.

View astemborskim's full-sized avatar

Matthew Astemborski astemborskim

View GitHub Profile
@astemborskim
astemborskim / index.js
Created April 1, 2015 21:02
Failure to redirect - using put method instead of Get
var express = require('express');
var router = express.Router();
var isAuthenticated = function (req, res, next) {
// if user is authenticated in the session, call the next() to call the next request handler
// Passport adds this method to request object. A middleware is allowed to add properties to
// request and response objects
if (req.isAuthenticated())
return next();
// if the user is not authenticated then redirect him to the login page
@astemborskim
astemborskim / app.js
Created March 27, 2015 21:32
Defining Controllers and Services
var app = angular.module('warehouseApp', ['ngResource']);
@astemborskim
astemborskim / list-controller.js
Created March 5, 2015 02:44
Client data to server side controller?
app.controller('listController', ['$scope', '$resource',
function ($scope, $resource){
$scope.prof={};
$scope.prof.check=false;
//$scope.prof.newName = {};
//Rest API Route on server
var Listing = $resource('/api/listing/:id', {}, { update : {method : 'PUT'}});
@astemborskim
astemborskim / animals-controller.js
Last active August 29, 2015 14:15
MEAN stack with Jade issue - Angular Directives in view not working
app.controller('animalsController', ['$scope',
function ($scope){
$scope.test = "This is a test";
$scope.animals = [
{ category : "Cats" },
{ category : "Dogs" },
{ cateogry : "Fish" },
{ category : "Reptiles" },
{ category : "Small Animals" }