Skip to content

Instantly share code, notes, and snippets.

View colinhoernig's full-sized avatar

Colin Hoernig colinhoernig

View GitHub Profile
@colinhoernig
colinhoernig / app.js
Created March 26, 2018 18:18 — forked from joshnuss/app.js
Express.js role-based permissions middleware
// the main app file
import express from "express";
import loadDb from "./loadDb"; // dummy middleware to load db (sets request.db)
import authenticate from "./authentication"; // middleware for doing authentication
import permit from "./permission"; // middleware for checking if user's role is permitted to make request
const app = express(),
api = express.Router();
// first middleware will setup db connection
#!/bin/sh
# Source http://lapwinglabs.com/blog/hacker-guide-to-setting-up-your-mac
# Worth looking at for dotfile stuff: http://dotfiles.github.io/
# Check for Homebrew,
# Install if we don't have it
if test ! $(which brew); then
echo "Installing homebrew..."
ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
fi