{"_id":"apis-expressionist","_rev":"28-cc6c709a554c0b8a14505b9fedfce8ee","name":"apis-expressionist","description":"Expresionist.wrapper(express).for(['Write', 'Document', 'Generate client']).of('REST APIs')","dist-tags":{"latest":"0.1.0"},"versions":{"0.0.1":{"name":"apis-expressionist","version":"0.0.1","description":"Wrapper on top express to Write, Document and 'Create the client'™ of REST APIs","main":"./index.js","keywords":["api","express"],"directories":{"lib":".","test":"test"},"scripts":{"test":"tap test/*.js"},"repository":{"type":"git","url":"git://github.com/llafuente/node-expressionist.git"},"author":{"name":"Luis Lafuente","email":"llafuente@noboxout.com","url":"http://www.noboxout.com"},"license":"MIT","engine":{"node":">=0.4"},"dependencies":{"express":"*","validator":"*"},"devDependencies":{"tap":"~0.2.5","request":"*"},"bugs":{"url":"https://github.com/llafuente/node-expressionist/issues"},"_id":"apis-expressionist@0.0.1","dist":{"shasum":"5a5d2fa18f589109d60e1def940e83bb3ef5ecb6","tarball":"https://registry.npmjs.org/apis-expressionist/-/apis-expressionist-0.0.1.tgz","integrity":"sha512-hypXXBlUewj+6uFZRJF6wIDyTpHi82EyQxle/NhoG9N1eHWHDhSK2X9nZZHdt2AgCbzD+rqJBYppTZD09sPA/A==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQCkBNIGCH0/qVeRnBb8/4PN3wBfMjce0m8/MGPaohYAZwIgccChAUD2SdSEA297St7ZeSR4NW6+uOVNDVWkVrITKQE="}]},"_from":".","_npmVersion":"1.3.5","_npmUser":{"name":"llafuente","email":"llafuente@noboxout.com"},"maintainers":[{"name":"llafuente","email":"llafuente@noboxout.com"}]},"0.0.2":{"name":"apis-expressionist","version":"0.0.2","description":"Wrapper on top express to Write, Document and 'Create the client'™ of REST APIs","main":"./index.js","keywords":["api","express"],"directories":{"lib":".","test":"test"},"scripts":{"test":"tap test/*.js"},"repository":{"type":"git","url":"git://github.com/llafuente/node-expressionist.git"},"author":{"name":"Luis Lafuente","email":"llafuente@noboxout.com","url":"http://www.noboxout.com"},"license":"MIT","engine":{"node":">=0.4"},"dependencies":{"express":"*","validator":"*"},"devDependencies":{"tap":"~0.2.5","request":"*"},"bugs":{"url":"https://github.com/llafuente/node-expressionist/issues"},"_id":"apis-expressionist@0.0.2","dist":{"shasum":"dd8298d03322967ef6f90bd31f7b1d604212440f","tarball":"https://registry.npmjs.org/apis-expressionist/-/apis-expressionist-0.0.2.tgz","integrity":"sha512-Q2LomoBQqLh9rPowgxtFQ4gYB/1XJTaLPfMUjnQQNXb7vXD/6YnEUoFcnduuKTKqorHLmheAgCd1g3MNTM0K4A==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQDJuiLawhaHgz7WQJuAyoIlIp4DbekvHSZR8GOs7qNKyAIhAN3McVsIQ8D0Xyy7naU61rbJ2T7F293DAsr1NbkKaUny"}]},"_from":".","_npmVersion":"1.3.5","_npmUser":{"name":"llafuente","email":"llafuente@noboxout.com"},"maintainers":[{"name":"llafuente","email":"llafuente@noboxout.com"}]},"0.0.3":{"name":"apis-expressionist","version":"0.0.3","description":"Wrapper on top express to Write, Document and 'Create the client'™ of REST APIs","main":"./index.js","keywords":["api","express"],"directories":{"lib":".","test":"test"},"scripts":{"test":"tap test/*.js"},"repository":{"type":"git","url":"git://github.com/llafuente/node-expressionist.git"},"author":{"name":"Luis Lafuente","email":"llafuente@noboxout.com","url":"http://www.noboxout.com"},"license":"MIT","engine":{"node":">=0.4"},"dependencies":{"express":"*","validator":"*"},"devDependencies":{"tap":"~0.2.5","request":"*"},"bugs":{"url":"https://github.com/llafuente/node-expressionist/issues"},"_id":"apis-expressionist@0.0.3","dist":{"shasum":"f7f1787be756ba7f56831d32251f763f9b0419dd","tarball":"https://registry.npmjs.org/apis-expressionist/-/apis-expressionist-0.0.3.tgz","integrity":"sha512-va7KOOBFC3rYbw6ybIOa42oi/Cof9yZPHq2VWCDptLPxbvtUY5OI1rq3h4oxXYE+d0fwcAlXmiDVe98Mvp6Eog==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQCzRD+zc8bIEYY+YV6CdLgGvpXUGfJM8q+uORumy4OPTwIgb2379XegF5Ls5sXVlruCNudJh7lJ4ItM86wOTHTteoY="}]},"_from":".","_npmVersion":"1.3.5","_npmUser":{"name":"llafuente","email":"llafuente@noboxout.com"},"maintainers":[{"name":"llafuente","email":"llafuente@noboxout.com"}]},"0.0.4":{"name":"apis-expressionist","version":"0.0.4","description":"Wrapper on top express to Write, Document and 'Create the client'™ of REST APIs","main":"./index.js","keywords":["api","express"],"directories":{"lib":".","test":"test"},"scripts":{"test":"tap test/*.js"},"repository":{"type":"git","url":"git://github.com/llafuente/node-expressionist.git"},"author":{"name":"Luis Lafuente","email":"llafuente@noboxout.com","url":"http://www.noboxout.com"},"license":"MIT","engine":{"node":">=0.4"},"dependencies":{"express":"*","validator":"*"},"devDependencies":{"tap":"~0.2.5","request":"*"},"bugs":{"url":"https://github.com/llafuente/node-expressionist/issues"},"_id":"apis-expressionist@0.0.4","dist":{"shasum":"46c9dba19db98a64cde3a7b3c48414035de826e5","tarball":"https://registry.npmjs.org/apis-expressionist/-/apis-expressionist-0.0.4.tgz","integrity":"sha512-EbMjjHRRd70/j2vTL7l4hRqOd7jFModdViGdpYThV6cLz1V25I9PuAAJ9U+VQIzWW9hImZfbnZIa+oztKgqqsw==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQCwgK2YB/q6xp5N1/LcO9yHFZULxWZ8QHwvmleIjUH+2QIhAKKff1lESJ18gv3IM+BzJDZ3M8DJ07DuxKa9dK4X5zl9"}]},"_from":".","_npmVersion":"1.3.5","_npmUser":{"name":"llafuente","email":"llafuente@noboxout.com"},"maintainers":[{"name":"llafuente","email":"llafuente@noboxout.com"}]},"0.0.5":{"name":"apis-expressionist","version":"0.0.5","description":"Wrapper on top express to Write, Document and 'Create the client'™ of REST APIs","main":"./index.js","keywords":["api","express"],"directories":{"lib":".","test":"test"},"scripts":{"test":"tap test/*.js"},"repository":{"type":"git","url":"git://github.com/llafuente/node-expressionist.git"},"author":{"name":"Luis Lafuente","email":"llafuente@noboxout.com","url":"http://www.noboxout.com"},"license":"MIT","engine":{"node":">=0.4"},"dependencies":{"express":"*","validator":"*"},"devDependencies":{"tap":"~0.2.5","request":"*"},"bugs":{"url":"https://github.com/llafuente/node-expressionist/issues"},"_id":"apis-expressionist@0.0.5","dist":{"shasum":"66c50075adee760b847e3c156b36a5d1a4800086","tarball":"https://registry.npmjs.org/apis-expressionist/-/apis-expressionist-0.0.5.tgz","integrity":"sha512-uqqnoGBT9Lt/77uhcOp9sRHYk/VbI4Qi5++qRLAZwmk4eNqU3dVhqka2BOHvuLjjU7GeI8xNHu89yZnBFauKeQ==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIHS/QZsWgCHEnc4wQfDIzkpEdq6KCJ1t6cEFFQ46Lr3cAiAFEbOTXYncOZBA7ThqA9STAD/WD+8sb0DYH/2m5MsyTA=="}]},"_from":".","_npmVersion":"1.3.5","_npmUser":{"name":"llafuente","email":"llafuente@noboxout.com"},"maintainers":[{"name":"llafuente","email":"llafuente@noboxout.com"}]},"0.0.6":{"name":"apis-expressionist","version":"0.0.6","description":"Wrapper on top express to Write, Document and 'Create the client'™ of REST APIs","main":"./index.js","keywords":["api","express"],"directories":{"lib":".","test":"test"},"scripts":{"test":"tap test/*.js"},"repository":{"type":"git","url":"git://github.com/llafuente/node-expressionist.git"},"author":{"name":"Luis Lafuente","email":"llafuente@noboxout.com","url":"http://www.noboxout.com"},"license":"MIT","engine":{"node":">=0.4"},"dependencies":{"express":"*","validator":"*"},"devDependencies":{"tap":"~0.2.5","request":"*"},"bugs":{"url":"https://github.com/llafuente/node-expressionist/issues"},"_id":"apis-expressionist@0.0.6","dist":{"shasum":"2a2fef5b5514dbfcf6edaa9826dae0fb998fdd64","tarball":"https://registry.npmjs.org/apis-expressionist/-/apis-expressionist-0.0.6.tgz","integrity":"sha512-ikY4UtPhJ3IoM1koC2vOOr5FP8CjwNP4xvUIMHnK/uaOnINGgLPL61JZ7ZI5nxvJg1TtXYeZodFjXt53ZHxnsw==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIAFKaiDosnaVGLNe3Mg3AFFf4pLhmTMPxC/VCI5vhtojAiEA6rbNcS91knQV/BqnMLHt2CJOUq8j9hRbczQTONEIydY="}]},"_from":".","_npmVersion":"1.3.5","_npmUser":{"name":"llafuente","email":"llafuente@noboxout.com"},"maintainers":[{"name":"llafuente","email":"llafuente@noboxout.com"}]},"0.0.7":{"name":"apis-expressionist","version":"0.0.7","description":"Wrapper on top express to Write, Document and 'Create the client'™ of REST APIs","main":"./index.js","keywords":["api","express"],"directories":{"lib":".","test":"test"},"scripts":{"test":"tap test/*.js"},"repository":{"type":"git","url":"git://github.com/llafuente/node-expressionist.git"},"author":{"name":"Luis Lafuente","email":"llafuente@noboxout.com","url":"http://www.noboxout.com"},"license":"MIT","engine":{"node":">=0.4"},"dependencies":{"express":"*","object-enhancements":"*","validator":"*"},"devDependencies":{"tap":"~0.2.5","request":"*"},"bugs":{"url":"https://github.com/llafuente/node-expressionist/issues"},"_id":"apis-expressionist@0.0.7","dist":{"shasum":"956d7fdd7603232991ae57ce8d7b6ca2d5107dcf","tarball":"https://registry.npmjs.org/apis-expressionist/-/apis-expressionist-0.0.7.tgz","integrity":"sha512-pY3skELHBFHsSbV3wBI7rk4/p15P8/F4McOG2ClL8SBbC1t2Kb4bwPdDN6X8LgoUhGCAHQURAcmUy+r8jyPMvg==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIC4eGMvVCoiwzRMjdPktkmmzraYKsP7pBn8ca6M7VfU7AiBOX2g0w6CDu5Y88PEI1Q6n1SpE1Gib83IadsNH/3pa/w=="}]},"_from":".","_npmVersion":"1.3.5","_npmUser":{"name":"llafuente","email":"llafuente@noboxout.com"},"maintainers":[{"name":"llafuente","email":"llafuente@noboxout.com"}]},"0.0.9":{"name":"apis-expressionist","version":"0.0.9","description":"Expresionist.wrapper(express).for(['Write', 'Document', 'Generate client']).of('REST APIs')","main":"./index.js","keywords":["api","express"],"directories":{"lib":".","test":"test"},"scripts":{"test":"tap test/test.js","coverage":"node test/code-coverage.js"},"repository":{"type":"git","url":"git://github.com/llafuente/node-expressionist.git"},"author":{"name":"Luis Lafuente","email":"llafuente@noboxout.com","url":"http://www.noboxout.com"},"license":"MIT","engine":{"node":">=0.4"},"dependencies":{"express":"*","js-yaml":"*","validator":"3.1.0","object-enhancements":"*","array-enhancements":"*"},"devDependencies":{"tap":"~0.2.5","ass":"*","request":"*"},"bugs":{"url":"https://github.com/llafuente/node-expressionist/issues"},"_id":"apis-expressionist@0.0.9","dist":{"shasum":"acf98fb2c6ccf869b8a74f24b3a7dbb890023160","tarball":"https://registry.npmjs.org/apis-expressionist/-/apis-expressionist-0.0.9.tgz","integrity":"sha512-9Jyb191Qew/8zAtSrboQbxWxHsl6/U4on4zND9jZGDP49iYacGqeQEpbT5WjRyERw4wlENkEYhfdo9n0xH4egQ==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQCsk4h+x5IMm0hLXjOfiZl/g2jiAqFCZ7sQndossoYRmQIhAPOW2gSNAk9ih5+LnciyJa7avIp3lSTTeyRGVPMdrimr"}]},"_from":".","_npmVersion":"1.2.32","_npmUser":{"name":"llafuente","email":"llafuente@noboxout.com"},"maintainers":[{"name":"llafuente","email":"llafuente@noboxout.com"}]},"0.0.10":{"name":"apis-expressionist","version":"0.0.10","description":"Expresionist.wrapper(express).for(['Write', 'Document', 'Generate client']).of('REST APIs')","main":"./index.js","keywords":["api","express"],"directories":{"lib":".","test":"test"},"scripts":{"test":"tap test/test.js","coverage":"node test/code-coverage.js"},"repository":{"type":"git","url":"git://github.com/llafuente/node-expressionist.git"},"author":{"name":"Luis Lafuente","email":"llafuente@noboxout.com","url":"http://www.noboxout.com"},"license":"MIT","engine":{"node":">=0.4"},"dependencies":{"express":"*","js-yaml":"*","validator":"3.1.0","object-enhancements":"*","array-enhancements":"*","function-enhancements":"*"},"devDependencies":{"tap":"~0.2.5","ass":"*","request":"*"},"bugs":{"url":"https://github.com/llafuente/node-expressionist/issues"},"homepage":"https://github.com/llafuente/node-expressionist","_id":"apis-expressionist@0.0.10","dist":{"shasum":"1a9e4da1362f55112eadb5a2a87e8ff58b47dbad","tarball":"https://registry.npmjs.org/apis-expressionist/-/apis-expressionist-0.0.10.tgz","integrity":"sha512-ScVuOz2KuQU0mCB/dkwdab456f+rlv89eMlrxyDu/VzBGWC9WAfcBpYo7G0SlfHCggENs3XSEBg7UZI79YVGxg==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQD4ct+G1Z2cLRZ3SvtWMIijxMOxZ9PygwyiK68riYQobAIgLumm+16nibbrW7hqq+O0ioR2O0cw4y5/BCnjFtOqmBs="}]},"_from":".","_npmVersion":"1.3.17","_npmUser":{"name":"llafuente","email":"llafuente@noboxout.com"},"maintainers":[{"name":"llafuente","email":"llafuente@noboxout.com"}]},"0.0.11":{"name":"apis-expressionist","version":"0.0.11","description":"Expresionist.wrapper(express).for(['Write', 'Document', 'Generate client']).of('REST APIs')","main":"./index.js","keywords":["api","express"],"directories":{"lib":".","test":"test"},"scripts":{"test":"tap test/test.js","coverage":"node test/code-coverage.js"},"repository":{"type":"git","url":"git://github.com/llafuente/node-expressionist.git"},"author":{"name":"Luis Lafuente","email":"llafuente@noboxout.com","url":"http://www.noboxout.com"},"license":"MIT","engine":{"node":">=0.4"},"dependencies":{"express":"*","js-yaml":"*","validator":"3.1.0","object-enhancements":"*","array-enhancements":"*","function-enhancements":"*","noboxout-log":"*"},"devDependencies":{"tap":"~0.2.5","ass":"*","request":"*"},"bugs":{"url":"https://github.com/llafuente/node-expressionist/issues"},"homepage":"https://github.com/llafuente/node-expressionist","_id":"apis-expressionist@0.0.11","dist":{"shasum":"562d6b72fb3b7af77e4b63b282837e2e894bb54d","tarball":"https://registry.npmjs.org/apis-expressionist/-/apis-expressionist-0.0.11.tgz","integrity":"sha512-6PUNmLMFna7ZSvam0lJZZPiV9rUVgCffpdGfmfpPYOhXRgWS1CtzR3z1lb4+uUnxL9sfdsCyudSeSb5VU0un2Q==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCICn6inSkJyaF5CYsgYFkJKiGBvxFr0UR8GnkOrqoOZWPAiEA/863rx/U8Gf9mZkrg5qgyTg8zkidSmnr0BZCEEbzYEw="}]},"_from":".","_npmVersion":"1.3.17","_npmUser":{"name":"llafuente","email":"llafuente@noboxout.com"},"maintainers":[{"name":"llafuente","email":"llafuente@noboxout.com"}]},"0.1.0":{"name":"apis-expressionist","version":"0.1.0","description":"Expresionist.wrapper(express).for(['Write', 'Document', 'Generate client']).of('REST APIs')","main":"./index.js","keywords":["api","express"],"directories":{"lib":".","test":"test"},"scripts":{"test":"tap test/test.js","coverage":"node test/code-coverage.js"},"repository":{"type":"git","url":"git://github.com/llafuente/node-expressionist.git"},"author":{"name":"Luis Lafuente","email":"llafuente@noboxout.com","url":"http://www.noboxout.com"},"license":"MIT","engine":{"node":">=0.4"},"dependencies":{"body-parser":"^1.0.0","cookie-parser":"^1.0.1","js-yaml":"*","object-enhancements":"*","array-enhancements":"*","function-enhancements":"*","noboxout-log":"*","utilitario":"*","express":"^4.5.1"},"devDependencies":{"tap":"~0.2.5","ass":"0.0.4","request":"*"},"bugs":{"url":"https://github.com/llafuente/node-expressionist/issues"},"homepage":"https://github.com/llafuente/node-expressionist","_id":"apis-expressionist@0.1.0","dist":{"shasum":"03a86ea9d8e48b352da4dc28ad7ce78862ebe90a","tarball":"https://registry.npmjs.org/apis-expressionist/-/apis-expressionist-0.1.0.tgz","integrity":"sha512-O/XgYkFhYufc1GxNDAiLf/u0+O87KJDUPH74NvqArD9ooAj2HFCv64pwqKG2TIiuTY/VNtYlfQOBFhLITOZOhg==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIAxl1M9r9hKd9pNCF0jDG9vbeW3SybLlEzwCkZCjkGVXAiEAzixcutA6WkoKbC2DzMucqYbodP1vjOCf1V37pmqLCLY="}]},"_from":".","_npmVersion":"1.4.3","_npmUser":{"name":"llafuente","email":"llafuente@noboxout.com"},"maintainers":[{"name":"llafuente","email":"llafuente@noboxout.com"}]}},"readme":"# node-expressionist [![Build Status](https://secure.travis-ci.org/llafuente/node-expressionist.png?branch=master)](http://travis-ci.org/llafuente/node-expressionist)\n\n![NPM](https://nodei.co/npm/apis-expressionist.png?compact=true)\n\n\n## Introduction\n\nExpresionist.wrapper(express).for(['Write', 'Document', 'Generate client']).of('REST APIs')\n\naka: Wrapper on top of express to Write, Document and 'Create the client'™ of REST APIs\n\n\n## How to write an API ?\n\nFirst write an YML with your URLs, Parameters, Validations, Constraints, Hooks, Handlers and Documentation. All in one place :)\n\nYou could use JSON too, in fact, YML is translated to JSON.\n\n**uris.yml**\n```yml\n\n# The identifier must be unique, YML overwrite keys.\nget-date-diff: # this will be the client function name camel-cased.\n    # Type of object, you can define more than just URIs...\n    type: uri\n\n    # array of methods: GET,POST,PUT,DELETE,PATCH,HEAD\n    methods: [GET]\n\n    # entry point\n    uri: /date-diff\n\n    # documentation, it's recommended to use |+ or >\n    doc: |+\n      Get the date difference between given and the server.\n\n    # FQFN: main function that will manage the request\n    handler: date.js:diff\n\n    # input validation via GET (query)\n    get:\n        date:\n            cast: date\n            doc: current client date\n            constraints:\n                date:\n    # input validation via POST (body)\n    post:\n\n    # input validation in the uri params\n    params:\n\n    # response validation (if success === true)\n    response:\n        diff:\n            cast: integer\n            doc: Difference in milliseconds\n\n    # custom data, can be retrieve via req.route.data in the handler\n    data:\n        #here put your application data, ex: access control using user-permissions\n```\n\n**server.js**\n```js\n\n    var Expressionist = require(\"apis-expressionist\"),\n        expressionist,\n        express = require(\"express\"),\n        app = express(),\n        cookieParser = require('cookie-parser'),\n        bodyParser = require('body-parser'),\n        router = express.Router();\n\n    // init express\n    app.use(cookieParser('no-more-secrets'));\n    app.use(bodyParser.urlencoded({ extended: false }))\n\n    // DO NOT: `app.use(router);` will be called for you\n\n\n    // init expressionist\n    expressionist = new Expresionist(app, router);\n    expressionist.rootDir = __dirname;\n\n    // loading YML file\n    expressionist.loadYML(\"uris.yml\", function () {\n    });\n\n    // I found interesting to concatenate various files, and group it\n    // groups can be used to export documentation and sort client code.\n    expressionist.loadYML([\"common-hooks.yml\", \"users.yml\"], \"users\", function () {\n        // note: YML exception will not match line in file\n\n        expressionist.listen(80);\n\n        //save documentation\n        expressionist.saveDoc();\n    });\n\n\n```\n\n## URI definitions (type: uri)\nContains the following parameters\n\n* **methods** (array, required)\n\n  GET, POST, PUT, DELETE, PATCH, HEAD\n\n* **uri** (string, required)\n\n  If the URL starts with \"/\", there will be no version-ing (recommended)\n  Otherwise expressionist.version (regexp) will be used to define the final URI.\n\n* **doc** (string, optional)\n\n  Documentation text. It's recommended to use \"|+\" instead of \">\" for multi-line text.\n\n* **params, get, post & files**\n\n  Input schema. See (utilitario)[https://github.com/llafuente/utilitario] module for more information.\n  * **cast**\n  * **constraints**, list/object of constraints that the input has to meet.\n  * **object**, require \"cast: object\", define the schema of each key\n  * **items**, require \"cast: array\", define each item schema\n  * **sanitize**, not only clean the input also can do some transformation to it, like lowercase\n  * **default**, set the default value (that will also be casted!)\n\n\n* **requestHooks** (array, optional) [More info](#requestHooks)\n\n  Callbacks that are executed before the handler.\n\n  Note: Must be defined before or will throw.\n\n* **requestHooksPolicy** (string[null, CONTINUE_ON_ERROR], optional)\n\n  When any requestHook add an error, the execution stop and return the error to the user.\n\n  In some cases you will want to continue even if errors are found like start-transaction / end-transaction\n\n  CONTINUE_ON_ERROR will execute all requestHook(**DONE**) and responseHooks(**TODO**) but not the handler.\n\n* **handler** (string)\n\n  [FQFN](#FQFN) of the handler.\n\n  Note: Parameters count is checked and throw an exception a difference is found.\n\n  The handler is a function and must have three parameters (req, res, next)\n\n  You can use handlerArguments: EXPAND to add inputs from get/post/param directly as arguments in the function (@todo link to example)\n\n* **handlerArguments** (string[COMPACT,EXPAND], optional) Default: COMPACT\n\n  Define how expressionist send arguments to the handler.\n  * **COMPACT**: just three arguments, same as express (req, res, next)\n  * **EXPAND**: will send input as arguments plus req, res & next.\n\n* **handlerArgumentsOrder** (array, optional) Default: null (will send inputs)\n\n  List of names with the arguments wanted. By default use all inputs with the following preference: params, get, post.\n\n  Do not handle name collisions. In case GET/POST input has the same name (not recommended!!) will use the first found using the preference above.\n\n* **requestHooks** (array, optional) [More info](#responseHooks)\n\n  Callbacks that are executed after the handler.\n\n  Note: Must be defined before or will throw.\n\n\n* **response**\n\n  Define response schema.\n  It's applied only if the response send success: true\n\n  If the response is invalid a error response will be sent instead.\n\n* **version** (number)\n  I plan to include this in the URL but can't find a proper way to do it. Any suggestions/issue!?\n\n\n## <a name=\"FQFN\"></a> FQFN\n\n**F** ully **Q** ualified **F** unction **N** ame.\nIt's just a way to translate a string into function but requiring a module, not just by name.\n\n```js\n\"users.js:get\" // tranlated into: require(\"users.js\").get\n\"users.js:read.one\" // tranlated into: require(\"users.js\").read.one\n\n// todo for future improvements\n\"users.js:!ret_get\" // tranlated into:  (new require(\"users.js\")).ret_get\n```\n\n\n### Handler default parameters (req, res, next)\n\n#### Request (req)\n\nExtend [express.request](http://expressjs.com/4x/api.html#req.params)\n\n* `route` It's all the route JSON, here you can access your \"data\"\n* `primary` Boolean (always true atm) is an internal-request ?\n\n#### Response (res)\n\nExtend [express.response](http://expressjs.com/4x/api.html#res.status)\n\n* `setResponse` (Object response)\n* `getResponse` () : Object\n* `addError` (Number: http_status, String: message, Number: code, String: long_message)\n* `hasErrors` () : Boolean\n* `addWarning` (String: message, Number: code, String: long_message)\n* `hasWarnings` (): Boolean\n* `content` = {}\n\n  variable where response, errors & warnings are stored. Use it with caution!\n\n**Do not use res.send** unlike you really want it!\n\nThis is not the way to work with `expressionist` (it's the `express` way). You should use: `setResponse`\n\n`expressionist` is compatible with existing `express` applications but encourage you to use another approach.\n\n\n#### Callback (next)\nit's the callback to continue with the execution.\nIt's a good practice to always use \"return next();\", avoid executing twice the callback.\nCalling twice next could lead to many many problems. We will try to implement something to avoid it in the future.\n\n\n### <a name=\"requestHooks\"></a> Request Hooks.\nThis are callbacks called before the handler.\n\nThe most common example could be session management, authentication, extra validations (like object exists in database).\n\nRequest hooks can addError(s) to response object, in that case handler will not be executed.\n\nAlso the default behavior is to stop after a Hook add any number of errors, to prevent this use: \"requestHooksPolicy: CONTINUE_ON_ERROR\", handler will not be executed event with CONTINUE_ON_ERROR.\n\n\nExample:\n\n```yml\n\n# define auth-hook\nauth-hook:\n    type: requestHook\n    target: auth.js:preHook\n    doc: >\n        Require Authentication\n\n# use auth-hook\nprivate-zone:\n    type: uri\n    methods: [GET]\n    uri: /private/zone\n    doc: >\n        This example amuse that you don't send any parameter.\n        You will have many errors in the response\n\n    # function handler must exists\n    handler: private.js:get_zone\n\n    # continue to see both errors\n    requestHooksPolicy: CONTINUE_ON_ERROR\n    requestHooks:\n        - auth-hook\n\n    get: # GET\n        do_not_send_me:\n            cast: string\n            constraints:\n                length: [1, 32]\n\n```\n\nResponse\n\n```js\n{ success: false,\n  errors: [\n    { code: 1000,\n      status: 400,\n      message: 'invalid-input',\n      long_message: '[do_not_send_me] is undefined' },\n    { code: undefined,\n      status: 403,\n      message: 'invalid-auth',\n      long_message: undefined\n    }\n  ]\n}\n```\n\nNote: Response HTTP status code will be the one in the first error: 400. Expressionist do not remove status from errors because could be useful in some cases.\n\n#### <a name=\"responseHooks\"></a>Response Hooks.\n\nSame idea as requestHooks, but this time after the handler, so they have the response.\nUseful for response encoding, set headers, close connections to database, etc.\n\n## Documentation\n\n`expressionist.saveDoc(\"doc.html\")`\n\nwill generate:\n* doc.html\n* documentator.css\n* documentator.html.js\n\nexample: [doc.html](http://htmlpreview.github.io/?https://github.com/llafuente/node-expressionist/blob/master/test/doc.html)\n\n## Client generation\n\nusage: expresionist.getNodeClient(String base_url)\n\nexample:\n\n```yml\n# It's recommended to start IDs with the group sent in loadYML/JSON\n# because the client is grouped by 'group'\nusers-read-one: #users.readOne\n    type: uri\n    methods: [GET]\n    uri: /users/:user_id\n    doc: >\n        Read user information\n\n    handler: users.js:read\n\n    params:\n        user_id:\n            cast: integer\n```\n\n```js\nexpressionist.loadYML(\"users.yml\", \"users\", function () {\n});\nvar client = expresionist.nodeClient(\"http://www.mydomain.com\");\n\nclient.users.readOne(1, {/*get*/}, {/*post*/}, function(err, response, body) {\n});\n```\n\nNotes:\n\n* Function name is camel case of the ID.\n* First arguments are params, in the order defined\n* Then GET/POST objects\n* Then the callback\n* everything is required\n\n\n## Why exceptions?\n\nExpressionist will throw only when find an invalid input that the developer write.\nAny other error (user input) will add errors to response.\n\n## Log\nexpressionist use noboxout-log.\n\n\nMute log\n```js\n    expressionistInstance.logMute = true;\n    expressionistInstance.logTraces = 2; // how many stack item should be displayed\n```\n\nAdjust verbosity\n```js\n    expressionistInstance.logLevel = 5; // all\n    expressionistInstance.logLevel = 4; // no verbose\n    expressionistInstance.logLevel = 3; // no verbose, debug\n    expressionistInstance.logLevel = 2; // no verbose, debug, info\n    expressionistInstance.logLevel = 1; // no verbose, debug, info, warn\n    expressionistInstance.logLevel = 0; // no verbose, debug, info, warn, error\n```","maintainers":[{"name":"llafuente","email":"llafuente@noboxout.com"}],"time":{"modified":"2022-06-13T03:14:06.396Z","created":"2013-09-13T11:38:57.896Z","0.0.1":"2013-09-13T11:39:03.917Z","0.0.2":"2013-09-16T15:29:04.091Z","0.0.3":"2013-09-17T15:33:35.700Z","0.0.4":"2013-09-18T10:10:57.847Z","0.0.5":"2013-09-18T12:59:49.950Z","0.0.6":"2013-09-18T15:21:52.538Z","0.0.7":"2013-09-23T11:24:19.906Z","0.0.9":"2014-01-11T00:59:54.028Z","0.0.10":"2014-02-03T10:55:49.283Z","0.0.11":"2014-02-05T11:25:14.715Z","0.1.0":"2014-07-08T11:11:58.892Z"},"author":{"name":"Luis Lafuente","email":"llafuente@noboxout.com","url":"http://www.noboxout.com"},"repository":{"type":"git","url":"git://github.com/llafuente/node-expressionist.git"},"readmeFilename":"README.markdown","homepage":"https://github.com/llafuente/node-expressionist","keywords":["api","express"],"bugs":{"url":"https://github.com/llafuente/node-expressionist/issues"},"license":"MIT"}