Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

ressendr

Package Overview
Dependencies
Maintainers
6
Versions
17
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

ressendr

## ResSendr - Friendly request handlers.

  • 0.1.5
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
6
Created
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

Package last updated on 25 Apr 2017

Did you know?

Socket

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
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc