Skip to content

Instantly share code, notes, and snippets.

View pramodrwt's full-sized avatar
💭
I may be slow to respond.

Pramod Rawat pramodrwt

💭
I may be slow to respond.
  • Delhi
View GitHub Profile
@pramodrwt
pramodrwt / app.js
Created July 13, 2018 07:40 — 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
@pramodrwt
pramodrwt / ultimate-ut-cheat-sheet.md
Created June 26, 2018 17:27 — forked from yoavniran/ultimate-ut-cheat-sheet.md
The Ultimate Unit Testing Cheat-sheet For Mocha, Chai and Sinon

The Ultimate Unit Testing Cheat-sheet

For Mocha, Chai and Sinon

using mocha/chai/sinon for node.js unit-tests? check out my utility: mocha-stirrer to easily reuse test components and mock require dependencies