New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

mellon-server

Package Overview
Dependencies
Maintainers
1
Versions
13
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

mellon-server - npm Package Compare versions

Comparing version 1.0.1 to 1.0.2

7

bin/mellon-server.js

@@ -14,2 +14,9 @@ #!/usr/bin/env node

//options['registry'] = [
// { path: 'inbox/.*' , do: function(req,res) {
// res.writeHead(200);
// res.end('ok');
// }}
//];
start_server(options);

20

index.js

@@ -7,3 +7,3 @@ const http = require('http');

let public_dir = './public';
let registry = {} ;
let registry = [] ;

@@ -25,4 +25,6 @@ const log4js = require('log4js');

try {
if (registry[pathItem]) {
registry[pathItem](req,res);
const reg = registryEntry(pathItem);
if (reg) {
reg(req,res);
logger.info(`${req.method} ${req.url} [${res.statusCode}] 0`);

@@ -62,2 +64,14 @@ return;

function registryEntry(pathItem) {
for (let i = 0 ; i < registry.length ; i++) {
let regex = new RegExp('^' + registry[i]['path']);
if (regex.test(pathItem)) {
return registry[i]['do'];
}
}
return null;
}
function doFile(path,req,res) {

@@ -64,0 +78,0 @@ const content = fs.readFileSync(path, { encoding: 'utf-8'});

2

package.json
{
"name": "mellon-server",
"version": "1.0.1",
"version": "1.0.2",
"description": "A small hackable HTTP server",

@@ -5,0 +5,0 @@ "main": "index.js",

@@ -8,3 +8,3 @@ # mellon-server

```
npm install pico-server
npm install mellon-server
```

@@ -15,3 +15,3 @@

```
const { start_server } = require('../index.js');
const { start_server } = require('mellon-server');

@@ -22,5 +22,5 @@ start_server({

public: './public'
registry: {
'demo': doDemo
}
registry: [
{ path: 'demo' , do: doDemo }
]
});

@@ -27,0 +27,0 @@

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