5.0.0 • Published 8 months ago

@janiscommerce/sls-api-rest v5.0.0

Weekly downloads
42
License
ISC
Repository
github
Last release
8 months ago

sls-api-rest

Build Status Coverage Status npm version

An integration handler for Serverless and JANIS Rest APIs

Installation

npm install @janiscommerce/sls-api-rest

Dependencies

This package only works properly with serverless-offline@5.9.0 or greater

Usage

'use strict';

const { SlsApiRest } = require('@janiscommerce/sls-api-rest');

module.exports.handler = (...args) => SlsApiRest.handler(...args);

Function minimal configuration

functions:
  handler: path/to/generic.handler
  package:
    include:
      - path/to/my/api/get.js
  events:
    - http:
        integration: lambda
        path: /some-entity/{entityId}
        method: GET
        request:
          parameters:
            paths:
              entityId: true
          # Some velocity template that includes this properties:
          # - headers
          # - method
          # - query
          # - body
          # - requestPath
          # Native support for this template en Serverless Framework was suggested in https://github.com/serverless/serverless/issues/6364
          # Still needed to work with serverless-offline
          template: ${file(./serverless/functions/subtemplates/lambda-request-with-path.yml)}
        # The response configuration to properly format body and headers + Error handling
        response: ${file(./serverless/functions/subtemplates/lambda-response-with-cors.yml)}
        # This is for serverless-offline only, because it doesn't use the `response` property (yet)
        responses: ${file(./serverless/functions/subtemplates/lambda-serverless-offline-responses.yml)}

Sample subtemplates can be found here:

5.0.0

8 months ago

4.0.0

1 year ago

3.5.1

1 year ago

3.5.0

1 year ago

3.4.0

2 years ago

3.3.0

2 years ago

3.1.1-beta.0

2 years ago

3.2.0

2 years ago

3.1.0

3 years ago

3.0.0

4 years ago

2.1.1

4 years ago

2.1.0

4 years ago

2.0.0

4 years ago

1.5.0

4 years ago

1.4.5

4 years ago

1.4.4

4 years ago

1.4.3

4 years ago

1.4.2

5 years ago

1.4.1

5 years ago

1.4.0

5 years ago

1.3.2

5 years ago

1.3.1

5 years ago

1.3.0

5 years ago

1.2.3

5 years ago

1.2.2

5 years ago

1.2.1

5 years ago

1.2.0

5 years ago

1.1.1

5 years ago

1.1.0

5 years ago

1.0.0

5 years ago