Socket
Socket
Sign inDemoInstall

node-http-server

Package Overview
Dependencies
Maintainers
4
Versions
40
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

node-http-server - npm Package Compare versions

Comparing version 8.0.0 to 8.1.0

12

package.json
{
"name": "node-http-server",
"version": "8.0.0",
"version": "8.1.0",
"description": "A very simple and fast http server for node, bash, and spawnable from C, Python etc. It is lightweight and great for embedded solutions as well as everyday development or public facing apps.",

@@ -8,4 +8,4 @@ "main": "server/Server.js",

"example": "example",
"doc":"docs",
"lib":"server"
"doc": "docs",
"lib": "server"
},

@@ -20,9 +20,7 @@ "engines": {

"test": "echo \"Error: no test specified\" && exit 1",
"basic": "node ./example/basic/basicApp.js",
"https": "node ./example/basic/https-ONLY-basicApp.js",
"both": "node ./example/basic/https-basicApp.js",
"template":"node ./example/advanced/basicTemplate.js",
"cluster":"node ./example/basic/cluster-basicApp.js",
"template": "node ./example/advanced/basicTemplate.js",
"cluster": "node ./example/basic/cluster-basicApp.js",
"docs": "docco-plus ./README.md ./example/* ./example/**/* ./server/* ./bin/* ./local-certs/* "

@@ -29,0 +27,0 @@ },

@@ -114,2 +114,21 @@ Node http server with https and proxy support

## request uri, query, and, body
For handling api requests, posts, puts patches etc with body data, we are now making that available on the request as both a ` String ` and ` Buffer ` incase you need images or videos uploaded.
|key|type |value|
|---|-----|-----|
|request.body| string | request body |
|request.url| string | processed uri |
|request.uri| object | parsed url information and query |
|request.serverRoot| string | local dir for publicly served data |
|key|type |value|
|---|-----|-----|
|uri.protocol |string| protocol of request|
|uri.host |string| hostname for domain|
uri.hostname |string| hostname for domain|
|uri.query |object| parsed querystring|
|uri.port |number| port request was received on|
### [Server Methods](http://riaevangelist.github.io/node-http-server/server/Server.js.html)

@@ -116,0 +135,0 @@

@@ -147,3 +147,3 @@ 'use strict';

// #### onRawRequest
// #### onRequest
//

@@ -734,26 +734,49 @@ // ` server.onRequest `

//return any value to force or specify delayed or manual serving
if(
this.onRequest(
request,
response,
completeServing.bind(this)
)
){
return;
};
request.body='';
const filename = path.join(
request.serverRoot,
request.url
);
request.on(
'data',
function(chunk){
request.body+=chunk;
}.bind(this)
).on(
'end',
function(){
if(this.config.verbose){
console.log(`###REQUEST BODY :
${request.body}
###
`);
}
fs.exists(
filename,
function fileExists(exists){
this.serveFile(filename,exists,request,response);
}.bind(this)
requestBodyComplete.bind(this,request,response)();
}.bind(this)
);
}
function requestBodyComplete(request,response){
//return any value to force or specify delayed or manual serving
if(
this.onRequest(
request,
response,
completeServing.bind(this)
)
){
return;
};
const filename = path.join(
request.serverRoot,
request.url
);
fs.exists(
filename,
function fileExists(exists){
this.serveFile(filename,exists,request,response);
}.bind(this)
);
}
module.exports=new Server;

Sorry, the diff of this file is not supported yet

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