Socket
Socket
Sign inDemoInstall

ressendr

Package Overview
Dependencies
282
Maintainers
6
Versions
17
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    ressendr

## ResSendr - Friendly request handlers.


Version published
Maintainers
6
Install size
11.1 MB
Created

Readme

Source

ResSender

ResSendr - Friendly request handlers.

Installing

$ npm install ressendr --save

Using

before

app.get('/hello',requestHandler)

function requestHandler(req, res){
  res.end('World!')
}
after
import r from 'ressendr'

app.get('/hello',r.handle(requestHandler))

function requestHandler(req){
  return 'World!';
}

Using with promises

before

app.get('/hello',requestHandler)

function requestHandler(req, res){
  asyncIO.get()
  .then((response)=>{
    res.end(response);
  })
}
after
import r from 'ressendr'

app.get('/hello',r.handle(requestHandler))

function requestHandler(req){
  return asyncIO.get()
}

Writing your own handlers

import r from 'ressendr'


//First we need a function that returns true or false
//true if the data can be handle by the handler.
//so lets write a number Handler

let isNumber = value => !isNaN(value);

//Now we need to handle the value and send it.

let handler = (v,res) => res.end(v.toString());

r.addHandler(isNumber,handler);

app.get('/hello',r.handle(requestHandler))

function requestHandler(req, res){
  return 2
}

FAQs

Last updated on 25 Apr 2017

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc