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

serverless-offline

Package Overview
Dependencies
Maintainers
1
Versions
407
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

serverless-offline - npm Package Compare versions

Comparing version 0.1.0 to 0.1.1

2

index.js

@@ -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*.

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