static-cling
Advanced tools
Comparing version 0.0.4 to 0.0.5
@@ -0,0 +0,0 @@ #!/usr/bin/env node |
@@ -5,3 +5,11 @@ var path = require('path'), | ||
url = require('url'), | ||
mime = require('mime'); | ||
mime = require('mime'), | ||
sendFileNotFound = function(res){ | ||
res.writeHead(404, { | ||
'Content-Type': 'text/plain' | ||
}); | ||
res.write('404 - File Not Found\n'); | ||
res.end(); | ||
return; | ||
}; | ||
@@ -13,3 +21,3 @@ var cling = function(port,rootPath, defaultFilename){ | ||
if(port === undefined){ | ||
port=3000; | ||
port = 3000; | ||
} | ||
@@ -19,3 +27,3 @@ if(defaultFilename === undefined){ | ||
} | ||
http.createServer(function (req, res) { | ||
@@ -26,8 +34,4 @@ var uri = url.parse(req.url).pathname; | ||
if (!exists) { | ||
res.writeHead(404, { | ||
'Content-Type': 'text/plain' | ||
}); | ||
res.write('404 - File Not Found\n'); | ||
res.end(); | ||
return; | ||
return sendFileNotFound(res); | ||
} | ||
@@ -37,2 +41,5 @@ | ||
filename = path.join(filename, defaultFilename); | ||
if(!path.existsSync(filename)){ | ||
return sendFileNotFound(res); | ||
} | ||
} | ||
@@ -39,0 +46,0 @@ |
{ "name": "static-cling" | ||
, "version": "0.0.4" | ||
, "version": "0.0.5" | ||
, "engines": [ "node >=0.6.0" ] | ||
, "description": "Static file server" | ||
, "author": "Kevin Isom (http://kevinisom.info)" | ||
, "repository" : { | ||
"type" : "git" | ||
, "url" : "git@github.com:Kevnz/Static-Cling.git" | ||
} | ||
, "bugs" : { | ||
"url": "https://github.com/Kevnz/Static-Cling/issues" | ||
} | ||
, "keywords" : [ "webserver", "fileserver" ] | ||
@@ -10,5 +17,5 @@ , "bin" : { "static" : "./bin/static.js" } | ||
, "directories": { | ||
"lib": "./lib/static" | ||
"lib": "./lib/static" | ||
} | ||
, "main": "./lib/static" | ||
} |
var cling = require('../lib/static').cling, | ||
port= 8083; | ||
console.log('starting server with port ' + port) | ||
cling(); | ||
cling(port); | ||
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
No bug tracker
MaintenancePackage does not have a linked bug tracker in package.json.
Found 1 instance in 1 package
No repository
Supply chain riskPackage does not have a linked source code repository. Without this field, a package will have no reference to the location of the source code use to generate the package.
Found 1 instance in 1 package
4068
83
1
19
1