compound-ex4
Version:
Compound-ex4 - MVC framework for NodeJS (ExpressJs 4 version), fork compoundjs(https://github.com/1602/compound)
78 lines (77 loc) • 5.72 kB
JSON
{
"_args": [
[
"railway-routes@>= 0.0.10",
"/home/webs/dev/prj/compoundjsEX4/compound-ex4"
]
],
"_from": "railway-routes@>=0.0.10",
"_id": "railway-routes@0.0.10",
"_inCache": true,
"_installable": true,
"_location": "/railway-routes",
"_npmUser": {
"email": "rpm1602@gmail.com",
"name": "anatoliy"
},
"_npmVersion": "1.3.14",
"_phantomChildren": {},
"_requested": {
"name": "railway-routes",
"raw": "railway-routes@>= 0.0.10",
"rawSpec": ">= 0.0.10",
"scope": null,
"spec": ">=0.0.10",
"type": "range"
},
"_requiredBy": [
"/"
],
"_shrinkwrap": null,
"_spec": "railway-routes@>= 0.0.10",
"_where": "/home/webs/dev/prj/compoundjsEX4/compound-ex4",
"author": {
"name": "Anatoliy Chakkaev"
},
"bugs": {
"url": "https://github.com/1602/railway-routes/issues"
},
"dependencies": {
"express": "3.x"
},
"description": "Resourceful routing for ExpressJS, ruby-on-rails 2 style",
"devDependencies": {
"mocha": "1.8.1",
"semicov": "0.1.1",
"should": "1.2.2"
},
"directories": {},
"dist": {
"shasum": "ec37ba71fbfcb27eed95e3637296efdcdf4b196d",
"tarball": "http://registry.npmjs.org/railway-routes/-/railway-routes-0.0.10.tgz"
},
"engines": {
"node": ">= 0.4.0"
},
"homepage": "http://railwajs.com/routing.html",
"main": "lib/railway_routes.js",
"maintainers": [
{
"name": "anatoliy",
"email": "rpm1602@gmail.com"
}
],
"name": "railway-routes",
"optionalDependencies": {},
"readme": "## Description\n\nThis is simple routing for ExpressJS framework. It allows you to write\nresourceful routes.\n\n## Using with Express\n\nAfter creating app instead of writing code like `app.get('smth', doSmth);` generate routes like that:\n\n var map = new require('railway-routes').Map(app, handler);\n map.resources('posts');\n map.namespace('admin', function (admin) {\n admin.resources('users');\n });\n\nIn this example `handler` function will called immediately for each route, accepting three args: `ns`, `controller`, `action` and should return method which will me actually called to server request.\n\nFor example you have two controllers: `posts` and `admin/users` which looks like regular modules:\n\n`controllers/posts_controller.js`\n\n exports.show = function (req, res) {\n res.send('show');\n };\n\n exports.edit = function (req, res) {\n res.send('edit');\n };\n\n exports.destroy = function (req, res) {\n res.send('destroy');\n };\n\n ...\n\nsame for `controllers/admin/users_controller.js`\n\nIn that case your handler should be:\n\n function handler(ns, controller, action) {\n try {\n var ctlFile = './controllers/' + ns + controller + '_controller';\n var responseHandler = require(ctlFile)[action];\n } catch(e) {}\n return responseHandler || function (req, res) {\n res.send('Handler not found for ' + ns + controller + '#' + action);\n };\n }\n\n## Features\n\n- resourceful routes\n- generic routes\n- url helpers\n- namespaces\n- custom helper names / paths for resources\n- named parameters in url helpers\n\n## Docs\n\nhttp://compoundjs.com/docs/#routing\n\n### Named route params\n\nExample:\n\n map.get('/test/:param1/:param2', 'controller#action');\n map.pathTo.test({param1: 'foo', param2: 'bar'}); // '/test/foo/bar'\n\n### Singleton resources\n\nExample:\n\n map.resource('account');\n\nWill generate the following routes:\n\n GET /account account#show\n POST /account account#create\n GET /account/new account#new\n GET /account/edit account#edit\n DELETE /account account#destroy\n PUT /account account#update\n\nSingleton resources can also have nested resources. For example:\n\n map.resource('account', function(account) {\n account.resources('posts');\n });\n\n## Example app\n\nCheck out [example app][1] to deal with middleware, route handling, and generic routes:\n\n git clone git://github.com/anatoliychakkaev/railway-routes-example-app.git\n cd railway-routes-example-app\n npm install\n node app.js\n\n## MIT License\n\n```\nCopyright (C) 2013 by Anatoliy Chakkaev <mail [åt] anatoliy [døt] in>\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in\nall copies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\nTHE SOFTWARE.\n```\n\n [1]: http://github.com/anatoliychakkaev/railway-routes-example-app\n",
"readmeFilename": "README.md",
"repository": {
"type": "git",
"url": "git://github.com/1602/railway-routes.git"
},
"scripts": {
"test": "make test"
},
"tags": "express, routing, ror, rails, railway",
"version": "0.0.10"
}