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

nodegate

Package Overview
Dependencies
Maintainers
1
Versions
26
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

nodegate - npm Package Compare versions

Comparing version 0.4.0 to 0.5.0

entities/route.js

8

entities/container.js

@@ -13,10 +13,6 @@ /**

query: request.query || {},
statusCode: 200,
});
const getEmpty = () => ({
headers: {},
body: {},
params: {},
query: {},
});
const getEmpty = () => extractFromRequest({});

@@ -23,0 +19,0 @@ module.exports = {

@@ -15,10 +15,10 @@ /**

return async (container) => {
const { body } = await request(container)[method](buildedUrl);
const { body, statusCode } = await request(container)[method](buildedUrl);
const containerMap = fromJS(container);
if (!key) {
return containerMap.mergeDeep(fromJS({ body })).toJS();
return containerMap.mergeDeep(fromJS({ body, statusCode })).toJS();
}
return containerMap.mergeDeep(fromJS({ body: { [key]: body } })).toJS();
return containerMap.mergeDeep(fromJS({ body: { [key]: body }, statusCode })).toJS();
};
};
{
"name": "nodegate",
"description": "API gateway made simple, fast and easy to configure.",
"version": "0.4.0",
"version": "0.5.0",
"author": "Julien Martin <martin.julien82@gmail.com>",

@@ -6,0 +6,0 @@ "license": "MIT",

@@ -11,3 +11,3 @@ /**

const express = require('express');
const { execute } = require('../entities/pipeline');
const { execute } = require('../entities/route');
const { getConfiguration } = require('../services/configuration');

@@ -32,2 +32,9 @@

const toArray = (value) => {
if (!Array.isArray(value)) {
return [value];
}
return value;
};
const nodegate = () => {

@@ -43,18 +50,10 @@ const expressApp = buildExpressApp();

app.beforeEach = (modifiers) => {
let modifiersToAdd = modifiers;
if (!Array.isArray(modifiers)) {
modifiersToAdd = [modifiers];
}
modifiersToAdd.forEach(modifier => beforeEach.push(modifier));
toArray(modifiers).forEach(modifier => beforeEach.push(modifier));
};
app.route = (routes) => {
let routesToAdd = routes;
if (!Array.isArray(routes)) {
routesToAdd = [routes];
}
routesToAdd.forEach((route) => {
toArray(routes).forEach((route) => {
expressApp[route.method.toLowerCase()](
route.path,
execute(route.pipeline, beforeEach),
execute(route, beforeEach),
);

@@ -61,0 +60,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