{"name":"ferrum","description":"Framework for node.js","version":"0.0.5-a","author":{"name":"Sergey Zvinsky","email":"s.zvinsky@gmail.com"},"contributors":[{"name":"Sergey Zvinsky","email":"s.zvinsky@gmail.com"}],"keywords":["ferrum","framework","web"],"repository":{"type":"git","url":"git://github.com/sergez/ferrum.git"},"engines":{"node":"*"},"directories":{"lib":"./lib","test":"./test"},"dependencies":{"winston":">=0.6.2","qs":">=0.5.3","formidable":">=1.0.11","cookies":">=0.3.5","keygrip":">=0.2.2","dustjs-linkedin":">=1.0.0"},"devDependencies":{"vows":"0.6.x","needle":"0.4.8"},"scripts":{"test":"vows --spec --isolate"},"main":"./lib/index","readme":"Ferrum [alfa] [![Build Status](https://travis-ci.org/sergez/ferrum.png?branch=master)](ferrum)\r\n=========\r\n\r\nWhat is it?\r\n-----------\r\n\r\nFerrum is simple and powerful framework for [node.js](http://nodejs.org). It's designed for quick and simple development of high-performance application. Ferrum don't force you to organize your code how it wants - it's up to you and i suppose it gives some flexibility in development of apps.\r\n\r\nInstalation\r\n-----------\r\n\r\n`npm install ferrum`\r\n\r\nHello, word\r\n-----------\r\nHere is an example of Ferrum app:\r\n\r\n```js\r\nvar util = require('util');\r\nvar ferrum = require('ferrum');\r\n\r\nfunction MainHandler () {\r\n    ferrum.RequestHandler.call(this);\r\n    \r\n    this.get = function () {\r\n        this.write(\"Hello, world!\");\r\n    };\r\n}\r\n\r\nutil.inherits(MainHandler, ferrum.RequestHandler);\r\n\r\nferrum.Application({\r\n    routes: {\r\n        '^/$': MainHandler\r\n    }\r\n}).run();\r\n```\r\n\r\nThen type http://localhost:8888  in browser address bar and enjoy.\r\n\r\nUsage\r\n-----\r\n\r\n* [Request handlers and arguments](#request-handlers-and-arguments)\r\n* [Query params](#query-params)\r\n\r\n\r\nRequest handlers and arguments\r\n------------------------------\r\nIn Ferrum application every URL or URL expression corresponds to handler based on `ferrum.RequestHandler`. This handler contains methods for processing GET, POST and others of http requests.\r\n\r\nAllowed http-methods and appropriate ferrum methods are:\r\n\r\n* GET       > get()\r\n* POST      > post()\r\n* PATCH     > patch()\r\n* PUT       > put()\r\n* DELETE    > del()\r\n* HEAD      > head()\r\n* OPTIONS   > options()\r\n\r\n\r\nIn following example the root path `/` points to MainHandler and the URL expression `/user/([0-9]+)` to UserHandler. Apart of that regular expression groups are passed as arguments to UserHandler handler.\r\n\r\n```\r\nfunction MainHandler () {\r\n    ferrum.RequestHandler.call(this);\r\n    \r\n    this.get = function () {\r\n        ...\r\n    };\r\n}\r\nutil.inherits(MainHandler, ferrum.RequestHandler);\r\n\r\n\r\nfuction UserHandler () {\r\n    ferrum.RequestHandler.call(this);\r\n    \r\n    this.get = function (userId) {\r\n        ...\r\n    };\r\n}\r\nutil.inherits(UserHandler, ferrum.RequestHandler);\r\n\r\nferrum.Application({\r\n    routes: {\r\n        '^/$': MainHandler,\r\n        '^/user/([0-9]+)$': UserHandler\r\n    }\r\n}).run();\r\n\r\n```\r\n\r\nQuery params\r\n------------\r\nTo work with query paramenters ferrum use third-party component [qs](https://npmjs.org/package/qs). The result of parsing query string is available in `ferrum.Request` object.\r\n\r\n```\r\n// GET http://localhost/params?params1=value1&params2=value2\r\n\r\nfunction ParamsHandler, () {\r\n    ferrum.RequestHandler.call(this);\r\n    \r\n    this.get = function () {\r\n        this.write(JSON.stringify(this.request.query));\r\n        // => {\"params1\":\"value1\",\"params2\":\"value2\"}\r\n    };\r\n}\r\nutil.inherits(ParamsHandler, ferrum.RequestHandler);\r\n\r\nferrum.Application({\r\n  routes: {\r\n    \t'^/params$': ParamsHandler\r\n\t}\r\n}).run();\r\n```\r\n\r\n\r\nLicense\r\n-------\r\n\r\nThe MIT License (MIT)\r\n\r\nCopyright (c) 2012 Sergey Zvinsky s.zvinsky@gmail.com\r\n\r\nPermission is hereby granted, free of charge, to any person obtaining a copy of this software and associated\r\ndocumentation files (the \"Software\"), to deal in the Software without restriction, including without limitation\r\nthe rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software,\r\nand to permit persons to whom the Software is furnished to do so, subject to the following conditions:\r\n\r\nThe above copyright notice and this permission notice shall be included in all copies or substantial portions of the\r\nSoftware.\r\n\r\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED\r\nTO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL\r\nTHE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,\r\n TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.","_id":"ferrum@0.0.5-a","dist":{"shasum":"dfdcff12a455064b7f5322548613d987867cc679","tarball":"http://registry-npm.ywwl.com/ferrum/download/ferrum-0.0.5-a.tgz","integrity":"sha512-LyFt+RHbLGTQ3d8SzCFTwC0+LfZb06bXRMboxGzILLiz3PVrIb/ACXSNVFZhT+CKrA0o79QrHNT7KOrFMGZsEA==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQCpOHBg1a66Qh1uWDckVlqvKS6VC6pN8Zjhrd5ARaGlagIgecrt0ELG3ModXsg8Oy8HdvbfamgHxq2Pn8vaoXpxzMc="}],"size":9612,"noattachment":false,"key":"/ferrum/-/ferrum-0.0.5a.tgz"},"_npmVersion":"1.1.62","_npmUser":{"name":"sergez","email":"s.zvinsky@live.com"},"maintainers":[{"name":"sergez","email":"s.zvinsky@live.com"}],"publish_time":1372354752711,"_cnpm_publish_time":1372354752711,"dist-tags":{"latest":"1.9.4"}}