Socket
Socket
Sign inDemoInstall

aws-endpoint

Package Overview
Dependencies
79
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    aws-endpoint

A utility for making mock servers to handle AWS requests


Version published
Weekly downloads
2
Maintainers
1
Install size
4.33 MB
Created
Weekly downloads
 

Readme

Source

aws-endpoint

A utility for making mock servers to handle AWS requests.

If you're writing a mock for testing purposes to handle calls that would normally go to AWS, this package makes it slightly easier.

It's basically just a thin shim over express, to add CORS and parsing of the x-amz-target header.

Usage

Install:

yarn add -D aws-endpoint

Import:

import { AwsEndpoint } from 'aws-endpoint';

Instantiate:

const endpoint = new AwsEndpoint('AWSServiceOfSomeKind', {
  AnAction(request, response) {
    // handle the AWSServiceOfSomeKind.AnAction request
  },

  async AnAsyncAction(request, response) {
    // promises are supported too
  }
});

Start:

// start on a specific port
await endpoint.start(8080);

// or let it pick a free one
const port = await endpoint.start()

Then make AWS requests using e.g. the AWS SDK as normal, but use the started server as the endpoint rather than the normal one.

Finally, stop the server:

endpoint.stop();

Notes

It's pretty basic to support a specific use case, but if there's something obvious missing for your particular needs, I'm open to pull requests.

Keywords

FAQs

Last updated on 09 Feb 2018

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc