Skip to content

Instantly share code, notes, and snippets.

@Mintonne
Mintonne / How to install Node.js on Digital Ocean.md
Last active February 13, 2019 09:39
How to install Node.js on Digital Ocean

LTS

curl -sL https://deb.nodesource.com/setup_10.x | sudo -E bash -

Latest

curl -sL https://deb.nodesource.com/setup_11.x | sudo -E bash -

Install

@Mintonne
Mintonne / app.js
Created September 19, 2022 00:16 — 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 "./authorization"; // middleware for checking if user's role is permitted to make request
const app = express(),
api = express.Router();
// first middleware will setup db connection