0.0.26 • Published 5 months ago

@gemeentenijmegen/apigateway-http v0.0.26

Weekly downloads
-
License
EUPL-1.2
Repository
github
Last release
5 months ago

AWS Apigateway HTTP helpers

A package useful when developing serverless functions using AWS Lambda/Apigateway. Supports the REST and HTTP flavors of the AWS API Gateway It contains:

V1/Response

A response object with several methods for common http responses. Return these from your lambda handler:

For V1 (rest) responses:

import { Response } from '@gemeentenijmegen/apigateway-http/lib/V1/Response';

For V2 (http) responses:

import { Response } from '@gemeentenijmegen/apigateway-http/lib/V2/Response';

Then use like this:

// Redirect to https://example.com
Response.redirect('https://example.com');

// Permanently redirect to https://example.com
Response.redirect('https://example.com', 301);

// Return http 403: Not allowed response
Response.error(403);

// Return a html page
Response.html('<!doctype html><html><head><title>My page</title></head><body>The html body</body></html>');

// Return a json response from a javascript object
Response.html({ key: 'value' });
0.0.20

10 months ago

0.0.21

9 months ago

0.0.22

9 months ago

0.0.23

8 months ago

0.0.24

7 months ago

0.0.25

6 months ago

0.0.17

12 months ago

0.0.18

11 months ago

0.0.19

11 months ago

0.0.26

5 months ago

0.0.16

1 year ago

0.0.11

1 year ago

0.0.12

1 year ago

0.0.13

1 year ago

0.0.14

1 year ago

0.0.15

1 year ago

0.0.8

2 years ago

0.0.7

2 years ago

0.0.6

2 years ago

0.0.5

2 years ago

0.0.4

3 years ago

0.0.3

3 years ago

0.0.2

3 years ago

0.0.1

3 years ago

0.0.0

3 years ago