{"_id":"express-resource-new","_rev":"26-586051b45e5505b536e2aa961a3de86d","name":"express-resource-new","description":"An enhancement to express-resource","dist-tags":{"latest":"0.1.1"},"versions":{"0.0.5":{"name":"express-resource-new","description":"An enhancement to express-resource","version":"0.0.5","repository":{"type":"git","url":"git://github.com/tpeden/express-resource-new.git"},"author":{"name":"TJ Peden","email":"tj.peden@tj-coding.com"},"dependencies":{"lingo":">=0.0.4"},"devDependencies":{"connect":"*","express":"*","mocha":"*","should":"*"},"keywords":["express","rest","resource","resources"],"main":"index","engines":{"node":">= 0.2.0"},"_npmUser":{"name":"tjpeden","email":"tj.peden@tj-coding.com"},"_id":"express-resource-new@0.0.5","optionalDependencies":{},"_engineSupported":true,"_npmVersion":"1.1.12","_nodeVersion":"v0.6.14","_defaultsLoaded":true,"dist":{"shasum":"631ee5e8ad042e4ee43e3fa27dc7cd3fe59c2b4c","tarball":"https://registry.npmjs.org/express-resource-new/-/express-resource-new-0.0.5.tgz","integrity":"sha512-MHfJK7FB85AO6vUFuHbCwqJ4/tVVT/i76hZw69MohQjgBfC7wGuN5ho42xeh5C/VWrgc04TfL18ywKnDyxNB4A==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQCNvq0f09z0ijByLCpFXpPv6sAhIO5INQboKRPQ9+1E2QIhAJUBmgb9u787Qk4sFfQWFHl1568YOD4qat8TUy4zRCL1"}]},"scripts":{},"maintainers":[{"name":"tjpeden","email":"tj.peden@tj-coding.com"}],"directories":{}},"0.0.6":{"name":"express-resource-new","description":"An enhancement to express-resource","version":"0.0.6","repository":{"type":"git","url":"git://github.com/tpeden/express-resource-new.git"},"author":{"name":"TJ Peden","email":"tj.peden@tj-coding.com"},"dependencies":{"lingo":">=0.0.4"},"devDependencies":{"connect":"*","express":"*","mocha":"*","should":"*"},"keywords":["express","rest","resource","resources"],"main":"index","engines":{"node":">= 0.2.0"},"_npmUser":{"name":"tjpeden","email":"tj.peden@tj-coding.com"},"_id":"express-resource-new@0.0.6","optionalDependencies":{},"_engineSupported":true,"_npmVersion":"1.1.12","_nodeVersion":"v0.6.14","_defaultsLoaded":true,"dist":{"shasum":"1b7a58c83cecb92b944a7e3d9d5e681976358703","tarball":"https://registry.npmjs.org/express-resource-new/-/express-resource-new-0.0.6.tgz","integrity":"sha512-yy4Cod2e5Nc02Hnf/jp9ZtBgXosSINo7qSU6Fd7JZnzwUb9DPu0yY5i7jK3lveCXYWBUVxfyk7MV87RjzTtBCQ==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQC46TK/ScNMiLY/JTwKIXk0m6QQYHkUVUpI33bGmofSGwIgE6WvnsND6aiKNBveKN3ONNNbDIxTPtufm6KgcE+BQrM="}]},"scripts":{},"maintainers":[{"name":"tjpeden","email":"tj.peden@tj-coding.com"}]},"0.0.7":{"name":"express-resource-new","description":"An enhancement to express-resource","version":"0.0.7","repository":{"type":"git","url":"git://github.com/tpeden/express-resource-new.git"},"author":{"name":"TJ Peden","email":"tj.peden@tj-coding.com"},"dependencies":{"lingo":">=0.0.4"},"devDependencies":{"connect":"*","express":"*","mocha":"*","should":"*"},"keywords":["express","rest","resource","resources"],"main":"index","engines":{"node":">= 0.2.0"},"_npmUser":{"name":"tjpeden","email":"tj.peden@tj-coding.com"},"_id":"express-resource-new@0.0.7","optionalDependencies":{},"_engineSupported":true,"_npmVersion":"1.1.12","_nodeVersion":"v0.6.14","_defaultsLoaded":true,"dist":{"shasum":"48c8373deb11b936f2820dcc48cf7def2338d773","tarball":"https://registry.npmjs.org/express-resource-new/-/express-resource-new-0.0.7.tgz","integrity":"sha512-Kj568vMYLHmQqzafNyE+aOUewk7rbWfCvA0LuhMIG9Q6eO8n3822KdLfLzoYHOKpI31+NE2yI833JrUSqORYOg==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQD3RMLFqwNtMX/Ck91rfgSHMd1TIRY+w9r5mMutcnLghgIgPFxNxDeOvPMEtA5k9xf/STTwgbAVk6h48d//X/VyLQY="}]},"scripts":{},"maintainers":[{"name":"tjpeden","email":"tj.peden@tj-coding.com"}]},"0.0.8":{"name":"express-resource-new","description":"An enhancement to express-resource","version":"0.0.8","repository":{"type":"git","url":"https://github.com/tpeden/express-resource-new"},"author":{"name":"TJ Peden","email":"tj.peden@tj-coding.com"},"dependencies":{"lingo":">=0.0.4"},"devDependencies":{"connect":"*","express":"*","mocha":"*","should":"*"},"keywords":["express","rest","resource","resources"],"main":"index","engines":{"node":">= 0.2.0"},"_id":"express-resource-new@0.0.8","dist":{"shasum":"bd49a15f371271eb2fbb1f1cb5d0450f3b3569f1","tarball":"https://registry.npmjs.org/express-resource-new/-/express-resource-new-0.0.8.tgz","integrity":"sha512-qX8eq4qBrHebW8ujkP8mDlMbG//o72AHCaVecDYAu7HQu28IRkuepXwekff2hNsDgEFm96c7bo6mUZZTnqmeOA==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQCDugh7CwfW5Asqb86sJRAUD2maclbR7uen8vSbc4S7bwIgWo3bqrFVvIm5Du589LkamuYqg+8pbrJzk5DrR2CisrQ="}]},"scripts":{},"maintainers":[{"name":"tjpeden","email":"tj.peden@tj-coding.com"}]},"0.0.9":{"name":"express-resource-new","description":"An enhancement to express-resource","version":"0.0.9","repository":{"type":"git","url":"git://github.com/tpeden/express-resource-new.git"},"author":{"name":"TJ Peden","email":"tj.peden@tj-coding.com"},"dependencies":{"lingo":">=0.0.4"},"devDependencies":{"connect":"*","express":"*","mocha":"*","should":"*"},"keywords":["express","rest","resource","resources"],"main":"index","engines":{"node":">= 0.2.0"},"_npmUser":{"name":"tjpeden","email":"tj.peden@tj-coding.com"},"_id":"express-resource-new@0.0.9","optionalDependencies":{},"_engineSupported":true,"_npmVersion":"1.1.12","_nodeVersion":"v0.6.14","_defaultsLoaded":true,"dist":{"shasum":"40c828e5471680c49dd754662153f178e38e5545","tarball":"https://registry.npmjs.org/express-resource-new/-/express-resource-new-0.0.9.tgz","integrity":"sha512-+UsYGEosEiOTjjyJhRcNqePwut0cQDWeieWf8pU1ndmisBfU32H01fw7GXHtEs74vmq6dzcNajUM9kZTsU27zQ==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQDbzr9Ww1nFpuNouI7gMPHFb2C71o/x40f5OFwhEIxszQIhAI17JdAw/5s8nqclFmD+RUZvbJ9E0ak9Vm75K0D7EpOA"}]},"scripts":{},"maintainers":[{"name":"tjpeden","email":"tj.peden@tj-coding.com"}]},"0.1.0":{"name":"express-resource-new","description":"An enhancement to express-resource","version":"0.1.0","repository":{"type":"git","url":"https://github.com/tpeden/express-resource-new"},"author":{"name":"TJ Peden","email":"tj.peden@tj-coding.com"},"dependencies":{"lingo":">=0.0.4"},"devDependencies":{"connect":"*","express":"2.x","mocha":"*","should":"*"},"keywords":["express","rest","resource","resources"],"main":"index","engines":{"node":">= 0.2.0"},"scripts":{"test":"mocha"},"readme":"[![build status](https://secure.travis-ci.org/tpeden/express-resource-new.png)](http://travis-ci.org/tpeden/express-resource-new)\n# Express Resource (new)\n\nexpress-resouce-new provides resourceful routing to express with improved nesting and auto-require.\n\n## Installation\n\nnpm:\n\n    $ npm install express-resource-new\n\n## Usage\n\nIn your main application file (i.e. app.js or server.js) just add the following:\n\n    var express = require('express'),\n        Resource = require('express-resource-new'), // <- Add this (Resource really isn't needed)\n        app = express.createServer();\n    \n    app.configure(function(){\n      app.set('views', __dirname + '/views');\n      // Add the following to your configure block (you can use any path you want)\n      app.set('controllers', __dirname + '/controllers');\n      /* ... */\n    });\n\nNow in the `./controllers` directory you can put your \"controllers\" with one or more of the supported actions as follows:\n\n`./controllers/articles/index.js`:\n\n    module.exports = {\n      index: function(request, response) {\n        response.send('articles index');\n      },\n      show: function(request, response) {\n        response.send('show article ' + request.params.article);\n      },\n      new: function(request, response) {\n        response.send('new article');\n      },\n      create: function(request, response) {\n        response.send('create article');\n      },\n      edit: function(request, response) {\n        response.send('edit article ' + request.params.article);\n      },\n      update: function(request, response) {\n        response.send('update article ' + request.params.article);\n      },\n      destroy: function(request, response) {\n        response.send('delete article ' + request.params.article);\n      }\n    };\n\nexpress-resource-new also supports a special action, `all`, that gets called for all other actions in the resource.\n\n    module.exports = {\n      all: function(request, response, next) {\n        // do some preloading or user authentication here\n        next();\n      },\n      index: function(request, response) {\n        response.send('articles index');\n      },\n      /* ... */\n    };\n\n\"What if I want to create a resource on the root path or change the id variable name or define middleware on specific actions?\" express-resource-new handles that by allowing you to set an `options` property on the controller object like so:\n\n    module.exports = {\n      options: {\n        root: true, // Creates resource on the root path (overrides name)\n        name: 'posts', // Overrides module name (folder name)\n        id: 'id', // Overrides the default id from singular form of `name`\n        before: { // Middleware support\n          show: auth,\n          update: [auth, owner],\n          destroy: [auth, owner]\n        }\n      },\n      index: function(request, response) {\n        response.send('articles index');\n      },\n      /* ... */\n    };\n\nLastly just call `app.resource()` with your controller name. Nesting is done by passing a function that can call `app.resource()` for each nested resource. Options can also be passed as the second parameter which override the options set in the controller itself.\n\n    var express = require('express'),\n        Resource = require('express-resource-new'),\n        app = express.createServer();\n    \n    app.configure(function(){\n      app.set('views', __dirname + '/views');\n      app.set('controllers', __dirname + '/controllers');\n      /* ... */\n    });\n    \n    app.resource('articles', function() {\n      app.resource('comments', { id: 'id' }); // You can also call `this.resource('comments')`\n    });\n\nYou can also create non-standard RESTful routes.\n\n`./controllers/comments/index.js`:\n\n    module.exports = {\n      index: function(request, response) {\n        response.send('comments index');\n      },\n      /* ... */\n      search: function(request, response) {\n        response.send(\"Search all comments on this article.\");\n      },\n      reply: function(request, response) {\n        response.send(\"Reply to comment: \" + request.params.comment);\n      }\n    };\n\n`./app.js`:\n\n    /* ... */\n    app.resource('articles', function() {\n      this.resource('comments', function() {\n        this.collection.get('search');\n        this.member.get('reply');\n      });\n    });\n\n## Default Action Mapping\n\nActions are, by default, mapped as shown below. These routs provide `req.params.article` for the substring where \":article\" is and, in the case of the nested routes, `req.params.comment` for the substring where \":comment\" is as shown below:\n\n    articles:\n    index   GET     /articles.:format?\n    new     GET     /articles/new.:format?\n    create  POST    /articles.:format?\n    show    GET     /articles/:article.:format?\n    edit    GET     /articles/:article/edit.:format?\n    update  PUT     /articles/:article.:format?\n    destroy DELETE  /articles/:article.:format?\n\n    article_comments:\n    index   GET     /articles/:article/comments.:format?\n    new     GET     /articles/:article/comments/new.:format?\n    create  POST    /articles/:article/comments.:format?\n    show    GET     /articles/:article/comments/:comment.:format?\n    edit    GET     /articles/:article/comments/:comment/edit.:format?\n    update  PUT     /articles/:article/comments/:comment.:format?\n    destroy DELETE  /articles/:article/comments/:comment.:format?\n\n## Content Negotiation\n\nContent negotiation is currently only provided through the `req.params.format` property, allowing you to respond accordingly.\n\n## Contributing\n\nPatches are welcome, fork away! :-)\n\n## License\n\n    The MIT License\n\n    Copyright (c) 2012 TJ Peden <tj.peden@tj-coding.com>\n\n    Permission is hereby granted, free of charge, to any person obtaining\n    a copy of this software and associated documentation files (the\n    'Software'), to deal in the Software without restriction, including\n    without limitation the rights to use, copy, modify, merge, publish,\n    distribute, sublicense, and/or sell copies of the Software, and to\n    permit persons to whom the Software is furnished to do so, subject to\n    the following conditions:\n\n    The above copyright notice and this permission notice shall be\n    included in all copies or substantial portions of the Software.\n\n    THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,\n    EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\n    MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.\n    IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY\n    CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,\n    TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE\n    SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n","_id":"express-resource-new@0.1.0","dist":{"shasum":"b74d08c8b3147adb185c7accacedcc0a763275ef","tarball":"https://registry.npmjs.org/express-resource-new/-/express-resource-new-0.1.0.tgz","integrity":"sha512-n6sEaOP9C2hjVzn93+qNrQ/HLwVD1hC1GFxIBI1p2Uh9jCpDgv/F6Dkfi5D4qmj9SWKuUjvcnbOn2coRiM0Upw==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIBggMfN/w6qjwgEMiHwmt1MU3vkpezm5qkPKUW9/rhc1AiAKhGTYk7y7WuJfDd32sPTq/SzAZ/+QqftwbODbhNIVmQ=="}]},"_npmVersion":"1.1.59","_npmUser":{"name":"tjpeden","email":"tj.peden@tj-coding.com"},"maintainers":[{"name":"tjpeden","email":"tj.peden@tj-coding.com"}]},"0.1.1":{"name":"express-resource-new","description":"An enhancement to express-resource","version":"0.1.1","repository":{"type":"git","url":"https://github.com/tpeden/express-resource-new"},"author":{"name":"TJ Peden","email":"tj.peden@tj-coding.com"},"dependencies":{"lingo":">=0.0.4","methods":"0.0.1"},"devDependencies":{"connect":"*","express":"3.x","mocha":"*","should":"*"},"keywords":["express","rest","resource","resources"],"main":"index","engines":{"node":">= 0.2.0"},"scripts":{"test":"mocha"},"readme":"[![build status](https://secure.travis-ci.org/tpeden/express-resource-new.png)](http://travis-ci.org/tpeden/express-resource-new)\n# Express Resource (new)\n\nexpress-resouce-new provides resourceful routing to express with improved nesting and auto-require.\n\n## Installation\n\nnpm:\n\n    $ npm install express-resource-new\n\n## Usage\n\nIn your main application file (i.e. app.js or server.js) just add the following:\n\n    var express = require('express'),\n        Resource = require('express-resource-new'), // <- Add this (Resource really isn't needed)\n        app = express.createServer();\n    \n    app.configure(function(){\n      app.set('views', __dirname + '/views');\n      // Add the following to your configure block (you can use any path you want)\n      app.set('controllers', __dirname + '/controllers');\n      /* ... */\n    });\n\nNow in the `./controllers` directory you can put your \"controllers\" with one or more of the supported actions as follows:\n\n`./controllers/articles/index.js`:\n\n    module.exports = {\n      index: function(request, response) {\n        response.send('articles index');\n      },\n      show: function(request, response) {\n        response.send('show article ' + request.params.article);\n      },\n      new: function(request, response) {\n        response.send('new article');\n      },\n      create: function(request, response) {\n        response.send('create article');\n      },\n      edit: function(request, response) {\n        response.send('edit article ' + request.params.article);\n      },\n      update: function(request, response) {\n        response.send('update article ' + request.params.article);\n      },\n      destroy: function(request, response) {\n        response.send('delete article ' + request.params.article);\n      }\n    };\n\nexpress-resource-new also supports a special action, `all`, that gets called for all other actions in the resource.\n\n    module.exports = {\n      all: function(request, response, next) {\n        // do some preloading or user authentication here\n        next();\n      },\n      index: function(request, response) {\n        response.send('articles index');\n      },\n      /* ... */\n    };\n\n\"What if I want to create a resource on the root path or change the id variable name or define middleware on specific actions?\" express-resource-new handles that by allowing you to set an `options` property on the controller object like so:\n\n    module.exports = {\n      options: {\n        root: true, // Creates resource on the root path (overrides name)\n        name: 'posts', // Overrides module name (folder name)\n        id: 'id', // Overrides the default id from singular form of `name`\n        before: { // Middleware support\n          show: auth,\n          update: [auth, owner],\n          destroy: [auth, owner]\n        }\n      },\n      index: function(request, response) {\n        response.send('articles index');\n      },\n      /* ... */\n    };\n\nLastly just call `app.resource()` with your controller name. Nesting is done by passing a function that can call `app.resource()` for each nested resource. Options can also be passed as the second parameter which override the options set in the controller itself.\n\n    var express = require('express'),\n        Resource = require('express-resource-new'),\n        app = express.createServer();\n    \n    app.configure(function(){\n      app.set('views', __dirname + '/views');\n      app.set('controllers', __dirname + '/controllers');\n      /* ... */\n    });\n    \n    app.resource('articles', function() {\n      app.resource('comments', { id: 'id' }); // You can also call `this.resource('comments')`\n    });\n\nYou can also create non-standard RESTful routes.\n\n`./controllers/comments/index.js`:\n\n    module.exports = {\n      index: function(request, response) {\n        response.send('comments index');\n      },\n      /* ... */\n      search: function(request, response) {\n        response.send(\"Search all comments on this article.\");\n      },\n      reply: function(request, response) {\n        response.send(\"Reply to comment: \" + request.params.comment);\n      }\n    };\n\n`./app.js`:\n\n    /* ... */\n    app.resource('articles', function() {\n      this.resource('comments', function() {\n        this.collection.get('search');\n        this.member.get('reply');\n      });\n    });\n\n## Default Action Mapping\n\nActions are, by default, mapped as shown below. These routs provide `req.params.article` for the substring where \":article\" is and, in the case of the nested routes, `req.params.comment` for the substring where \":comment\" is as shown below:\n\n    articles:\n    index   GET     /articles.:format?\n    new     GET     /articles/new.:format?\n    create  POST    /articles.:format?\n    show    GET     /articles/:article.:format?\n    edit    GET     /articles/:article/edit.:format?\n    update  PUT     /articles/:article.:format?\n    destroy DELETE  /articles/:article.:format?\n\n    article_comments:\n    index   GET     /articles/:article/comments.:format?\n    new     GET     /articles/:article/comments/new.:format?\n    create  POST    /articles/:article/comments.:format?\n    show    GET     /articles/:article/comments/:comment.:format?\n    edit    GET     /articles/:article/comments/:comment/edit.:format?\n    update  PUT     /articles/:article/comments/:comment.:format?\n    destroy DELETE  /articles/:article/comments/:comment.:format?\n\n## Content Negotiation\n\nContent negotiation is currently only provided through the `req.params.format` property, allowing you to respond accordingly.\n\n## Contributing\n\nPatches are welcome, fork away! :-)\n\n## License\n\n    The MIT License\n\n    Copyright (c) 2012 TJ Peden <tj.peden@tj-coding.com>\n\n    Permission is hereby granted, free of charge, to any person obtaining\n    a copy of this software and associated documentation files (the\n    'Software'), to deal in the Software without restriction, including\n    without limitation the rights to use, copy, modify, merge, publish,\n    distribute, sublicense, and/or sell copies of the Software, and to\n    permit persons to whom the Software is furnished to do so, subject to\n    the following conditions:\n\n    The above copyright notice and this permission notice shall be\n    included in all copies or substantial portions of the Software.\n\n    THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,\n    EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\n    MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.\n    IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY\n    CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,\n    TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE\n    SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n","_id":"express-resource-new@0.1.1","dist":{"shasum":"2af830d7a9e4950abfe621386ccd5c27717a21a2","tarball":"https://registry.npmjs.org/express-resource-new/-/express-resource-new-0.1.1.tgz","integrity":"sha512-0Wy0SiJLLQKko97rUODJZBATh5J85cTHPEgtfNxH7pu9hUQHm4QN1iqKoJ8HOx0lr/Qie883gJRhAt2czCkWiQ==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQC0vewjWU5k0zgWx/FUgF1ChkMVRIuOWI0c1RjJ+RZfQAIgdykwNFOJyOPAiuPpzhy1ZuY7/0H0V7kZQn63WgAQv98="}]},"_npmVersion":"1.1.63","_npmUser":{"name":"tjpeden","email":"tj.peden@tj-coding.com"},"maintainers":[{"name":"tjpeden","email":"tj.peden@tj-coding.com"}]}},"readme":"# Express Resource (new)\n\nexpress-resouce-new provides resourceful routing to express with improved nesting and auto-require.\n\n## Installation\n\nnpm:\n\n    $ npm install express-resource-new\n\n## Usage\n\nIn your main application file (i.e. app.js or server.js) just add the following:\n\n    var express = require('express'),\n        Resource = require('express-resource-new'), // <- Add this (Resource really isn't needed)\n        app = express.createServer();\n    \n    app.configure(function(){\n      app.set('views', __dirname + '/views');\n      // Add the following to your configure block (you can use any path you want)\n      app.set('controllers', __dirname + '/controllers');\n      /* ... */\n    });\n\nNow in the `./controllers` directory you can put your \"controllers\" with one or more of the supported actions as follows:\n\n`./controllers/articles/index.js`:\n\n    module.exports = {\n      index: function(request, response) {\n        response.send('articles index');\n      },\n      show: function(request, response) {\n        response.send('show article ' + request.params.article);\n      },\n      new: function(request, response) {\n        response.send('new article');\n      },\n      create: function(request, response) {\n        response.send('create article');\n      },\n      edit: function(request, response) {\n        response.send('edit article ' + request.params.article);\n      },\n      update: function(request, response) {\n        response.send('update article ' + request.params.article);\n      },\n      destroy: function(request, response) {\n        response.send('delete article ' + request.params.article);\n      }\n    };\n\nexpress-resource-new also supports a special action, `all`, that gets called for all other actions in the resource.\n\n    module.exports = {\n      all: function(request, response, next) {\n        // do some preloading or user authentication here\n        next();\n      },\n      index: function(request, response) {\n        response.send('articles index');\n      },\n      /* ... */\n    };\n\n\"What if I want to create a resource on the root path or change the id variable name?\" express-resource-new handles that by allowing you to set an `options` property on the controller object like so:\n\n    module.exports = {\n      options: {\n        root: true, // Creates resource on the root path (overrides name)\n        name: 'posts', // Overrides module name (folder name)\n        id: 'id' // Overrides the default id from singular form of `name`\n      },\n      index: function(request, response) {\n        response.send('articles index');\n      },\n      /* ... */\n    };\n\nLastly just call `app.resource()` with your controller name. Nesting is done by passing a function that can call `app.resource()` for each nested resource. Options can also be passed as the second parameter which override the options set in the controller itself.\n\n    var express = require('express'),\n        Resource = require('express-resource-new'),\n        app = express.createServer();\n    \n    app.configure(function(){\n      app.set('views', __dirname + '/views');\n      app.set('controllers', __dirname + '/controllers');\n      /* ... */\n    });\n    \n    app.resource('articles', function() {\n      app.resource('comments', { id: 'id' }); // You can also call this.resource('comments')\n    });\n\n## Default Action Mapping\n\nActions are, by default, mapped as shown below. These routs provide `req.params.article` for the substring where \":article\" is and, in the case of the nested routes, `req.params.comment` for the substring where \":comment\" is as shown below:\n\n    articles:\n    index   GET     /articles.:format?\n    new     GET     /articles/new.:format?\n    create  POST    /articles.:format?\n    show    GET     /articles/:article.:format?\n    edit    GET     /articles/:article/edit.:format?\n    update  PUT     /articles/:article.:format?\n    destroy DELETE  /articles/:article.:format?\n\n    article_comments:\n    index   GET     /articles/:article/comments.:format?\n    new     GET     /articles/:article/comments/new.:format?\n    create  POST    /articles/:article/comments.:format?\n    show    GET     /articles/:article/comments/:comment.:format?\n    edit    GET     /articles/:article/comments/:comment/edit.:format?\n    update  PUT     /articles/:article/comments/:comment.:format?\n    destroy DELETE  /articles/:article/comments/:comment.:format?\n\n## Content Negotiation\n\nContent negotiation is currently only provided through the `req.params.format` property, allowing you to respond accordingly.\n\n## License\n\n    The MIT License\n\n    Copyright (c) 2012 TJ Peden <tj.peden@tj-coding.com>\n\n    Permission is hereby granted, free of charge, to any person obtaining\n    a copy of this software and associated documentation files (the\n    'Software'), to deal in the Software without restriction, including\n    without limitation the rights to use, copy, modify, merge, publish,\n    distribute, sublicense, and/or sell copies of the Software, and to\n    permit persons to whom the Software is furnished to do so, subject to\n    the following conditions:\n\n    The above copyright notice and this permission notice shall be\n    included in all copies or substantial portions of the Software.\n\n    THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,\n    EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\n    MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.\n    IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY\n    CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,\n    TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE\n    SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n","maintainers":[{"name":"tjpeden","email":"tj.peden@tj-coding.com"}],"time":{"modified":"2022-06-17T22:34:33.199Z","created":"2012-05-11T01:25:55.196Z","0.0.5":"2012-05-11T01:25:57.020Z","0.0.6":"2012-05-27T18:54:31.048Z","0.0.7":"2012-06-01T04:57:26.963Z","0.0.8":"2012-07-12T16:19:39.183Z","0.0.9":"2012-07-13T18:33:16.105Z","0.1.0":"2012-10-04T20:39:49.592Z","0.1.1":"2013-02-10T07:07:52.317Z"},"author":{"name":"TJ Peden","email":"tj.peden@tj-coding.com"},"repository":{"type":"git","url":"https://github.com/tpeden/express-resource-new"},"users":{"lea_io":true}}