Package Exports
- deliver
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (deliver) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
deliver
Deliver local and remote static files.
Install
npm install deliver --saveUsage
Local file
var deliver = require('deliver');
var http = require('http');
http.createServer(function (req, res) {
// Conditionally set the request url
req.url = '/some';
deliver(req).pipe(res);
}).listen(3000);Remote file (proxy)
var deliver = require('deliver');
var http = require('http');
http.createServer(function (req, res) {
// Conditionally set the request url
req.url = 'http://www.somewhere.com/somefile.html';
deliver(req, {
statusCode: 404
}).pipe(res);
}).listen(3000);deliver(path[, options])
Returns a stream
path- the path, relative or an http url, of the file to serveroptionsroot- set the root directory that holds the static files to servestatusCode- set the response status code. Overrides when proxying a remote file
Run Tests
npm install
npm test