New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

send-json

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

send-json

Send JSON over http

latest
Source
npmnpm
Version
2.0.0
Version published
Maintainers
1
Created
Source

send-json

build status

Send objects as JSON over http.

Example

var http = require('http');
var sendJson = require('send-json');

var server = http.createServer(function(req, res) {
  sendJson(req, res, {hello: 'world'});
});

server.listen(3000);

Or you can just add a send function to the http response object like this.

var http = require('http');
var sendJson = require('send-json');

var server = http.createServer(function(req, res) {
  res.send = sendJson.bind(null, req, res);

  res.send({hello: 'world'});
});

server.listen(3000);

License

MIT License

Keywords

json

FAQs

Package last updated on 18 Nov 2014

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