New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

fiddleware

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

fiddleware - npm Package Compare versions

Comparing version 0.0.1 to 0.0.2

lib/respond-json.js

2

lib/index.js
'use strict';
module.exports = {
Greeter: require('./greeter'),
respondJson: require('./respond-json'),
};
{
"name": "fiddleware",
"version": "0.0.1",
"version": "0.0.2",
"description": "Connect/Express middleware library with common utility functions.",

@@ -35,2 +35,3 @@ "main": "index.js",

"config": "^1.19.0",
"connect-route": "^0.1.5",
"eslint-config-airbnb": "^4.0.0",

@@ -42,4 +43,6 @@ "eslint-plugin-react": "^3.16.1",

"gulp-istanbul": "^0.10.3",
"gulp-mocha": "^2.2.0"
"gulp-mocha": "^2.2.0",
"should": "^8.2.1",
"supertest": "^1.1.0"
}
}

@@ -12,4 +12,20 @@ # fiddleware

** TODO ** Documentation for components.
* respondJson() - Add .json(data, responseCode) method to 'res' objects in pipeline.
## Middleware Types
### **respondJson()**
Simple JSON response extension for outgoing response object which stringifies the
specified object, sets the HTTP response code and content type headers:
const fiddleware = require('fiddleware');
app.use(fiddleware.respondJson());
function doSomething(req, res) {
// Return all of the JSONs.
res.json({
foo: 'bar'}, 200);
}
Please note that HTTP status code is defaulted to 200 if the second parameter is not passed.
## Licencing

@@ -16,0 +32,0 @@ This repository is MIT licensed. That means you can use it freely without restriction or attribution.

Sorry, the diff of this file is not supported yet

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