api-gateway-sim

1.4.0 • Public • Published

api-gateway-sim

AWS API Gateway simulator for Node JS Lambda

Install

$ npm install -g api-gateway-sim

To run, you need to export your configuration from AWS API Gateway console. Choose "Export as Swagger + API Gateway Integrations". alt text

See details in Export an API from Api Gateway

Running the simulator using ags cli

cd <node lambda directory>
$ ags --swagger <exported swagger json file>.json
 

Testing your lambda

$ curl http://localhost:3000/

Using different listening port

$ PORT=4000 ags --swagger <file>.json

Command Line Help

  Usage: ags [options]
 
  Options:
 
    -h, --help                      output usage information
    -V, --version                   output the version number
    -i, --timeout <lambda timeout>  Default is 3 seconds
    -s, --swagger <file>            Swagger config file
    -e, --event <file>              Default file event.json
    -c, --context <file>            Default file context.json file
    -t, --stage-variables <file>    Default file stage-variables.json file
    -p, --port <port>               Api gateway port, default 3000
    -a, --ags-server                Run AGS UI
    -b, --with-basepath             Include base path in the endpoint
    -u, --strict-cors               Enable CORS base on config file
    -g, --ags-port <port>           AGS UI port, default 4000

Features

  • Supports Body Mapping Templates
  • Supports Body Mapping Template validation.
$ ags -a
 
# From your browser open http://localhost:4000 
  • Supports integration responses
  • Supports event.json, context.json, and stage-variables.json
  • Continues to monitoring changes in your lambda code. YES! No need to restart ags
  • Support for json or yaml swagger file.
  • Monitor changes in event.json, context.json, and stage-variables.json
  • CORS - enabled by default
  • Supports lambda timeout
  • Supports base path
  • Supports {proxy+}
  • Supports proxy integration isBase64Encoded, multiValueHeaders, and multiValueQueryStringParameters

Versions

Current Tags

VersionDownloads (Last 7 Days)Tag
1.4.03latest

Version History

VersionDownloads (Last 7 Days)Published
1.4.03
1.3.00
1.2.290
1.2.280
1.2.270
1.2.260
1.2.250
1.2.240
1.2.230
1.2.220
1.2.210
1.2.200
1.2.190
1.2.180
1.2.170
1.2.160
1.2.140
1.2.130
1.2.120
1.2.110
1.2.100
1.2.90
1.2.81
1.2.70
1.2.60
1.2.50
1.2.40
1.2.30
1.2.20
1.2.10
1.2.00
1.1.50
1.1.40
1.1.30
1.1.20
1.1.10
1.1.00
1.0.130
1.0.120
1.0.110
1.0.100
1.0.90
1.0.80
1.0.70
1.0.60
1.0.50
1.0.40
1.0.30
1.0.21
1.0.10
1.0.00

Package Sidebar

Install

npm i api-gateway-sim

Weekly Downloads

5

Version

1.4.0

License

MIT

Unpacked Size

298 kB

Total Files

60

Last publish

Collaborators

  • elitechance