Skip to content

Instantly share code, notes, and snippets.

View jb7959's full-sized avatar
🦧
Oops!

Jaeyeoul Ahn jb7959

🦧
Oops!
View GitHub Profile
@jb7959
jb7959 / app.js
Created September 18, 2020 06:13 — 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
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.