Skip to content

Instantly share code, notes, and snippets.

@montanaflynn
Last active August 29, 2015 14:22
Show Gist options
  • Save montanaflynn/2beb2a49e464e1821cad to your computer and use it in GitHub Desktop.
Save montanaflynn/2beb2a49e464e1821cad to your computer and use it in GitHub Desktop.

Start Kong

kong start

Register API with Kong

curl -i -X POST \
  --url http://localhost:8001/apis/ \
  --data 'name=mockbin' \
  --data 'target_url=http://mockbin.com/' \
  --data 'public_dns=mockbin.com'

Get API ID from Kong

# After we get the APIs we pipe to JQ for the data and sed to strip double quotes
export APIID=$( curl -s http://localhost:8001/apis/ | jq .data[0].id | sed "s/\"//g")

Add CORS plugin

curl -X POST http://localhost:8001/plugins_configurations/ \
  --data "name=cors" \
  --data "api_id=$APIID"

Siege the server

siege -v -H "host:mockbin.com" http://localhost:8000/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment