basic-node-server
Advanced tools
Comparing version 1.0.1 to 1.0.2
16
index.js
@@ -7,19 +7,13 @@ const http = require('http'); | ||
const csvFilePath = path.join(__dirname, '/application.csv'); | ||
const mimeJson = path.join(__dirname, '/mime.json'); | ||
const getContentType = (() => { | ||
return new Promise((resolve, reject) => { | ||
fs.readFile(csvFilePath, 'utf8', (err, csvData) => { | ||
fs.readFile(mimeJson, 'utf8', (err, data) => { | ||
if (err) { | ||
reject(err); | ||
} else { | ||
const contentTypeMap = csvData.split('\n') | ||
.map(row => row.split(',')) | ||
.reduce((map, [extension, contentType]) => { | ||
map[extension] = contentType; | ||
return map; | ||
}, {}); | ||
resolve(contentTypeMap); | ||
} | ||
else { | ||
resolve(data); | ||
} | ||
}); | ||
@@ -26,0 +20,0 @@ }) |
{ | ||
"name": "basic-node-server", | ||
"version": "1.0.1", | ||
"version": "1.0.2", | ||
"description": "Simple node server for everyone.", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -18,1 +18,15 @@ # basic-node-server | ||
``` | ||
## NPM | ||
This package is also available on NPM. To install it, run: | ||
``` | ||
npm install basic-node-server | ||
``` | ||
Then, to run it, run from your project directory: | ||
``` | ||
node node_modules/basic-node-server/index.js [port] | ||
``` |
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
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
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
1257
32
46582
2