flatiron-handlers
Flatiron Handlers is a flatiron http plugin provides the following methods to the flatiron http application:
Install
npm install flatiron-handlers
Usage
flatiron = require 'flatiron'app = flatironappappuse flatironpluginshttpappuse handlersapprouterget '/'->appplain res'foo'
API
app.text(res, text)
Parameter | Type | Required | Description |
---|---|---|---|
res | Object | yes | http response object |
text | string | yes | text to send in response |
example
approuterget '/'-> apptext @res'foobar'
approuter;
app.html(res, html)
Parameter | Type | Required | Description |
---|---|---|---|
res | Object | yes | Response Object |
html | string | yes | Html to return to response |
example: see Source
app.redirect(res, location)
Parameter | Type | Required | Description |
---|---|---|---|
res | Object | yes | Response Object |
location | string | yes | location to redirect to |
example: see Source
app.json(res, data, status)
Parameter | Type | Required | Description |
---|---|---|---|
res | Object | yes | Response Object |
data | Object | yes | JSON to return to response |
status | integer | no | status code to return with json response |
example: see Source
roadmap
check [issues][2]
contribute
everyone is welcome to contribute. patches, bugfixes, new features
- create an [issue][2] on github so the community can comment on your idea
- fork
nano
in github - create a new branch
git checkout -b my_branch
- create tests for the changes you made
- make sure you pass both existing and newly inserted tests
- commit your changes
- push to your branch
git push origin my_branch
- create an pull request
tests
npm install mocha -gnpm installnpm test
license
see LICENSE