Socket
Socket
Sign inDemoInstall

gcf-api-router

Package Overview
Dependencies
1
Maintainers
1
Versions
9
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 0.2.1 to 0.2.2

LICENSE

29

index.js
const pathToRegexp = require('path-to-regexp');
module.exports = function() {
return new RequestHandler();
}
function RequestHandler() {
if (!(this instanceof RequestHandler)) {
return new RequestHandler();
}
function RequestHandler() {
this.idx = null;

@@ -32,3 +32,2 @@ this.routes = [];

this.routes.push({
path: path,
pathRegex: pathRegex,

@@ -43,29 +42,23 @@ pathKeys: pathKeys.map(key => key.name),

RequestHandler.prototype.get = function(onRequest) {
let addMethodToRoute = addMethod.bind(this);
return addMethodToRoute('GET', onRequest);
return addMethod.call(this, 'GET', onRequest);
}
RequestHandler.prototype.post = function(onRequest) {
let addMethodToRoute = addMethod.bind(this);
return addMethodToRoute('POST', onRequest);
return addMethod.call(this, 'POST', onRequest);
}
RequestHandler.prototype.put = function(onRequest) {
let addMethodToRoute = addMethod.bind(this);
return addMethodToRoute('PUT', onRequest);
return addMethod.call(this, 'PUT', onRequest);
}
RequestHandler.prototype.delete = function(onRequest) {
let addMethodToRoute = addMethod.bind(this);
return addMethodToRoute('DELETE', onRequest);
return addMethod.call(this, 'DELETE', onRequest);
}
RequestHandler.prototype.patch = function(onRequest) {
let addMethodToRoute = addMethod.bind(this);
return addMethodToRoute('PATCH', onRequest);
return addMethod.call(this, 'PATCH', onRequest);
}
RequestHandler.prototype.options = function(onRequest) {
let addMethodToRoute = addMethod.bind(this);
return addMethodToRoute('OPTIONS', onRequest);
return addMethod.call(this, 'OPTIONS', onRequest);
}

@@ -119,1 +112,3 @@

}
module.exports = RequestHandler;
{
"name": "gcf-api-router",
"version": "0.2.1",
"version": "0.2.2",
"description": "Express-style API router for Google Cloud Functions",

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

"API",
"router"
"router",
"serverless"
],

@@ -23,4 +24,4 @@ "bugs": {

"dependencies": {
"path-to-regexp": "^2.0.0"
"path-to-regexp": "^2.1.0"
}
}
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc