{"action":"created","issue":{"url":"https://api.github.com/repos/trailsjs/trails-docs/issues/4","repository_url":"https://api.github.com/repos/trailsjs/trails-docs","labels_url":"https://api.github.com/repos/trailsjs/trails-docs/issues/4/labels{/name}","comments_url":"https://api.github.com/repos/trailsjs/trails-docs/issues/4/comments","events_url":"https://api.github.com/repos/trailsjs/trails-docs/issues/4/events","html_url":"https://github.com/trailsjs/trails-docs/pull/4","id":147815574,"number":4,"title":"feat(concept/policies): Update policies and examples.","user":{"login":"maissani","id":1372756,"avatar_url":"https://avatars.githubusercontent.com/u/1372756?v=3","gravatar_id":"","url":"https://api.github.com/users/maissani","html_url":"https://github.com/maissani","followers_url":"https://api.github.com/users/maissani/followers","following_url":"https://api.github.com/users/maissani/following{/other_user}","gists_url":"https://api.github.com/users/maissani/gists{/gist_id}","starred_url":"https://api.github.com/users/maissani/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/maissani/subscriptions","organizations_url":"https://api.github.com/users/maissani/orgs","repos_url":"https://api.github.com/users/maissani/repos","events_url":"https://api.github.com/users/maissani/events{/privacy}","received_events_url":"https://api.github.com/users/maissani/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":{"login":"jaumard","id":2970449,"avatar_url":"https://avatars.githubusercontent.com/u/2970449?v=3","gravatar_id":"","url":"https://api.github.com/users/jaumard","html_url":"https://github.com/jaumard","followers_url":"https://api.github.com/users/jaumard/followers","following_url":"https://api.github.com/users/jaumard/following{/other_user}","gists_url":"https://api.github.com/users/jaumard/gists{/gist_id}","starred_url":"https://api.github.com/users/jaumard/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jaumard/subscriptions","organizations_url":"https://api.github.com/users/jaumard/orgs","repos_url":"https://api.github.com/users/jaumard/repos","events_url":"https://api.github.com/users/jaumard/events{/privacy}","received_events_url":"https://api.github.com/users/jaumard/received_events","type":"User","site_admin":false},"milestone":null,"comments":7,"created_at":"2016-04-12T17:08:53Z","updated_at":"2016-04-14T14:26:12Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/trailsjs/trails-docs/pulls/4","html_url":"https://github.com/trailsjs/trails-docs/pull/4","diff_url":"https://github.com/trailsjs/trails-docs/pull/4.diff","patch_url":"https://github.com/trailsjs/trails-docs/pull/4.patch"},"body":"# Feature : Concept / Policies\r\n\r\n- [x] Adding How to use\r\n\r\n- [x] miss spelling and miss understanding on docs. \r\n\r\n \r\n "},"comment":{"url":"https://api.github.com/repos/trailsjs/trails-docs/issues/comments/209968991","html_url":"https://github.com/trailsjs/trails-docs/pull/4#issuecomment-209968991","issue_url":"https://api.github.com/repos/trailsjs/trails-docs/issues/4","id":209968991,"user":{"login":"jaumard","id":2970449,"avatar_url":"https://avatars.githubusercontent.com/u/2970449?v=3","gravatar_id":"","url":"https://api.github.com/users/jaumard","html_url":"https://github.com/jaumard","followers_url":"https://api.github.com/users/jaumard/followers","following_url":"https://api.github.com/users/jaumard/following{/other_user}","gists_url":"https://api.github.com/users/jaumard/gists{/gist_id}","starred_url":"https://api.github.com/users/jaumard/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jaumard/subscriptions","organizations_url":"https://api.github.com/users/jaumard/orgs","repos_url":"https://api.github.com/users/jaumard/repos","events_url":"https://api.github.com/users/jaumard/events{/privacy}","received_events_url":"https://api.github.com/users/jaumard/received_events","type":"User","site_admin":false},"created_at":"2016-04-14T14:26:12Z","updated_at":"2016-04-14T14:26:12Z","body":"Express version : \r\n\r\n```\r\n 'use strict'\r\n  const Policy = require('trails-policy')\r\n\r\n  /**\r\n   * @module ExamplePolicy\r\n   * @description This is the example policy\r\n   */\r\n  module.exports = class ExamplePolicy extends Policy {\r\n    test(req, res, next) {\r\n      const secret = req.body.secret\r\n      // Your own logic\r\n      /**\r\n      * The following code is an example:\r\n      * It stop when the secret parametter is passed and continue to the Controller when there is no secret parametter.\r\n      */\r\n      if (secret != '') {\r\n        // Stop and return with a custom message\r\n        return res.send('Your secret is' + secret)\r\n      }\r\n      // Continue to Example Controller\r\n      next()\r\n    }\r\n  }\r\n```"}}