serverless-offline
Advanced tools
Comparing version 0.1.0 to 0.1.1
@@ -80,3 +80,3 @@ 'use strict'; | ||
if(process.env.DEBUG) SCli.log(`Route: ${method} ${path}`); | ||
SCli.log(`Route: ${method} ${path}`); | ||
@@ -83,0 +83,0 @@ this.server.route({ |
{ | ||
"name": "serverless-offline", | ||
"version": "0.1.0", | ||
"version": "0.1.1", | ||
"description": "Simulates your API Gateway ressources locally to call your lambda functions offline", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -7,11 +7,7 @@ # Serverless Offline Plugin | ||
See 'Credits and inspiration'. | ||
See [Credits and inspiration](https://github.com/dherault/serverless-offline#credits-and-inspiration). | ||
### Requierements | ||
Node v4 and over. | ||
### Installation | ||
In your Serverless project: | ||
Requires Node v4 and over. In your Serverless project: | ||
@@ -52,3 +48,3 @@ ``` | ||
To do so, in your `s-project.json` file, set options to be passed to babel-register like this: | ||
``` | ||
```javascript | ||
{ | ||
@@ -60,3 +56,3 @@ /* ... */ | ||
/* Your own options, example: */ | ||
presets: ["es2015", "stage-2"] | ||
"presets": ["es2015", "stage-2"] | ||
} | ||
@@ -82,11 +78,12 @@ } | ||
module.exports.handler = function(event, context) { | ||
+ var params; | ||
+ | ||
+ if (event.isServerlessOffline) { // Offline | ||
+ params = event.params; | ||
+ } else { // Online | ||
+ /* Define your event object using a template in your s-function.json file */ | ||
+ params = event.customKeyDefinedInTemplate; | ||
+ } | ||
+}; | ||
var params; | ||
if (event.isServerlessOffline) { // Locally | ||
/* Hapijs request object */ | ||
params = event.params; | ||
} else { // On AWS Lambda | ||
/* Define your event object using a template in your s-function.json file */ | ||
params = event.customKeyDefinedInTemplate; | ||
} | ||
}; | ||
``` | ||
@@ -93,0 +90,0 @@ - *Serve* will pick the first non `default` response of an endpoint if `errorPattern` is undefined. Doing so, it neglects the `default` answer (so it does not work out of the box with `serverless project create`). This causes new projects to answer 400 using *Serve*. |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Environment variable access
Supply chain riskPackage accesses environment variables, which may be a sign of credential stuffing or data theft.
Found 1 instance in 1 package
11235
4
108