Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

mellon-server

Package Overview
Dependencies
Maintainers
0
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.8 to 1.0.9

4

handler/demo.js

@@ -1,6 +0,6 @@

function handle(req,res) {
function handle(req,res,options) {
res.writeHead(200);
res.end('Yeah! :)');
res.end(`Yeah! :) ${JSON.stringify(options)}`);
}
module.exports = { handle };

@@ -27,6 +27,6 @@ const http = require('http');

try {
const reg = registryEntry(pathItem);
const entry = registryEntry(pathItem);
if (reg) {
reg(req,res);
if (entry) {
entry['function'](req,res,entry['options']);
logger.info(`${address} - ${req.method} ${req.url} [${res.statusCode}] 0`);

@@ -72,6 +72,7 @@ return;

if (regex.test(pathItem)) {
const entry = registry[i]['do'];
const entry = registry[i]['do'];
const options = registry[i]['with'];
if (typeof entry === 'function') {
return entry;
return { function: entry , options: options };
}

@@ -83,3 +84,3 @@ else {

registry[i]['do'] = func;
return func;
return { function: func , options: options };
}

@@ -86,0 +87,0 @@ }

{
"name": "mellon-server",
"version": "1.0.8",
"version": "1.0.9",
"description": "A small hackable HTTP server",

@@ -11,3 +11,4 @@ "main": "index.js",

"scripts": {
"server": "npx mellon-server"
"server": "npx mellon-server",
"server-registry": "npx mellon-server --registry registry-example.json"
},

@@ -14,0 +15,0 @@ "dependencies": {

@@ -29,7 +29,7 @@ # mellon-server

{ path: 'demo' , do: doDemo },
{ path: 'test/.*', do: './hander/demo.js'}
{ path: 'test/.*', do: './hander/demo.js', with: { myOption: 123 }}
]
});
function doDemo(req,res) {
function doDemo(req,res,opts) {
res.writeHead(200);

@@ -36,0 +36,0 @@ res.end('Hello World!');

[
{ "path": "demo/.*" , "do": "./handler/demo.js" }
{ "path": "demo/.*" , "do": "./handler/demo.js" , "with": { "test": 123 }}
]
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