Tried to extract auth-logic into a node-module