mulab / mu-gateway

Configurable route gateway with authentication and authorization

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

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;
    }
  }
}

About

Configurable route gateway with authentication and authorization

License:Other


Languages

Language:JavaScript 100.0%