Skip to content

Latest commit

 

History

History
24 lines (22 loc) · 586 Bytes

README.md

File metadata and controls

24 lines (22 loc) · 586 Bytes

mu-gateway

Configurable route gateway with authentication and authorization

Configuration

export default {
  "target": "<protocol>://<hostname>:<port>[path]",
  "dbUrl": "mongodb://<host>:<port>/<name>",
  "default": function(method, user) {
    if (method === 'GET') return true;
    return false;
  }
  "rules": {
    "/profile/:name": function(method, user, name) {
      if (method === 'GET') return true;
      else if (method === 'POST') {
        if (user["name"] === name || "admin" in user["group"]) return true;
      }
      return false;
    }
  }
}