Code Monkey home page Code Monkey logo

serverless-http-invoker's Introduction

npm version license Build Status JavaScript Style Guide

serverless-http-invoker

Locally invoke Serverless functions via their HTTP event as specified in Serverless.yml.

It makes it easy to test not only your handler logic, but also ensures that you have your http events setup properly in serverless.yml without deploying.

Usage

Use it in tests of Serverless functions to test your HTTP endpoints along with the handler code. For example, you can write the following to test a Serverless function:

it('should invoke simple path', function () {
  let response = invoker.invoke('GET api/hello')  
  return expect(response).to.eventually.have.property('statusCode', 200)
})

The test above is a test of a Serverless function defined in Serverless.yml as follows:

functions:
  hello:
    handler: handler.hello
    events:
      - http:
          path: api/hello
          method: get

Many more examples and exaustive list of what is supported in the tests. Some additional real-world examples are demonstrated in the sheetmonkey-server project. See PluginsHandler.js and PluginAuthHandler.js among others.

Installation

npm (npm install serverless-http-invoker --save-dev) or yarn (yarn add serverless-http-invoker --dev)

serverless-http-invoker's People

Contributors

activescott avatar dhessler avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.