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

claudia-api-builder

Package Overview
Dependencies
Maintainers
1
Versions
38
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

claudia-api-builder - npm Package Compare versions

Comparing version 0.2.0 to 0.3.0

2

package.json
{
"name": "claudia-api-builder",
"version": "0.2.0",
"version": "0.3.0",
"description": "Simplify AWS ApiGateway handling",

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

@@ -8,23 +8,26 @@ /*global module */

['GET', 'POST', 'PUT'].forEach(function (method) {
self[method.toLowerCase()] = function (route, handler) {
var pathPart = route.replace(/^\//, '');
self[method.toLowerCase()] = function (route, handler, options) {
var pathPart = route.replace(/^\//, '').toLowerCase(),
canonicalRoute = route.toLowerCase();
if (!/^\//.test(canonicalRoute)) {
canonicalRoute = '/' + route;
}
if (!methodConfigurations[pathPart]) {
methodConfigurations[pathPart] = { methods: [] };
methodConfigurations[pathPart] = {} ;
}
if (methodConfigurations[pathPart].methods.indexOf(method) === -1) {
methodConfigurations[pathPart].methods.push(method);
methodConfigurations[pathPart][method] = (options || {});
if (!routes[canonicalRoute]) {
routes[canonicalRoute] = {};
}
if (!routes[route]) {
routes[route] = {};
}
routes[route][method] = handler;
routes[canonicalRoute][method] = handler;
};
});
self.apiConfig = function () {
return methodConfigurations;
return {version: 2, routes: methodConfigurations};
};
self.router = function (event, context) {
var handler, result;
var handler, result, path;
if (event && event.context && event.context.path && event.context.method) {
handler = routes[event.context.path] && routes[event.context.path][event.context.method];
path = event.context.path.toLowerCase();
handler = routes[path] && routes[path][event.context.method];
if (handler) {

@@ -31,0 +34,0 @@ try {

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