flatiron-handlers

Response http status handlers

flatiron-handlers

Flatiron Handlers is a flatiron http plugin provides the following methods to the flatiron http application:

npm install flatiron-handlers

flatiron = require 'flatiron'
app = flatiron.app
 
app.use flatiron.plugins.http
app.use handlers
 
app.router.get '/'->
  app.plain res'foo'
 
ParameterTypeRequiredDescription
resObjectyeshttp response object
textstringyestext to send in response

example

app.router.get '/'-> app.text @res'foobar'
app.router.get('/', function() { return app.text(@res, 'foobar') });
ParameterTypeRequiredDescription
resObjectyesResponse Object
htmlstringyesHtml to return to response

example: see Source

ParameterTypeRequiredDescription
resObjectyesResponse Object
locationstringyeslocation to redirect to

example: see Source

ParameterTypeRequiredDescription
resObjectyesResponse Object
dataObjectyesJSON to return to response
statusintegernostatus code to return with json response

example: see Source

roadmap

check [issues][2]

contribute

everyone is welcome to contribute. patches, bugfixes, new features

  1. create an [issue][2] on github so the community can comment on your idea
  2. fork nano in github
  3. create a new branch git checkout -b my_branch
  4. create tests for the changes you made
  5. make sure you pass both existing and newly inserted tests
  6. commit your changes
  7. push to your branch git push origin my_branch
  8. create an pull request

tests

npm install mocha -g
npm install
npm test
 

license

see LICENSE