diff --git a/README.md b/README.md index 71a8b39..1928f2b 100644 --- a/README.md +++ b/README.md @@ -20,7 +20,6 @@ Azure, Google & IBM. ## Contents -1. [Installation](#installation) 1. [Quick Start](#quick-start) 1. [Motivation](#motivation) 1. [Components](#components) @@ -35,63 +34,14 @@ Azure, Google & IBM. 1. [Clustering](#clustering) 1. [Background](#background) -## Installation - -On macOS or Linux run the following: - -``` -curl -sfL https://raw.githubusercontent.com/serverless/event-gateway/master/install.sh | sh -``` - -On Windows download [binary](https://github.com/serverless/event-gateway/releases). ## Quick Start -_Check out [`event-gateway-examples` repo](https://github.com/serverless/event-gateway-examples) for more examples._ - -### Running Locally - -Run `event-gateway` in `dev` mode: - -``` -event-gateway -dev -``` - -### Register a Function - -Register an AWS Lambda function in the Function Discovery. - -``` -curl --request POST \ - --url http://127.0.0.1:4001/v1/functions \ - --header 'content-type: application/json' \ - --data '{"functionId": "hello", "provider":{"type": "awslambda", "arn": "", "region": "", "accessKeyId": "", "secretAccessKey": ""}}' -``` - -### Subscribe to an Event - -Once the function is register you can subscribe it to you custom event. +The easiest way to get started with the event-gateway is using the [Serverless framework](https://serverless.com). The framework is setup to automatically download and install the event-gateway during development of a serverless service. -``` -curl --request POST \ - --url http://127.0.0.1:4001/v1/subscriptions \ - --header 'content-type: application/json' \ - --data '{"functionId": "hello", "event": "pageVisited"}' -``` - -### Emit an Event - -An event can be emitted using [Events API](#events-api). - -``` -curl --request POST \ - --url http://127.0.0.1:4000/ \ - --header 'content-type: application/json' \ - --header 'event: pageVisited' \ - --data '{"userId": "123"}' -``` +_Check out [`event-gateway-example` repo](https://github.com/serverless/event-gateway-example) for a walkthrough of using the event-gateway in local development._ -After emitting the event subscribed function is called asynchronously. +If you want to install and develop with the event-gateway without the framework, [instructions can be found here](./docs/developing.md). ## Motivation diff --git a/docs/developing.md b/docs/developing.md new file mode 100644 index 0000000..1c58e60 --- /dev/null +++ b/docs/developing.md @@ -0,0 +1,56 @@ +# Developing + +## Installation + +On macOS or Linux run the following: + +``` +curl -sfL https://raw.githubusercontent.com/serverless/event-gateway/master/install.sh | sh +``` + +On Windows download [binary](https://github.com/serverless/event-gateway/releases). + + +## Running Locally + +Run `event-gateway` in `dev` mode: + +``` +event-gateway -dev +``` + +### Register a Function + +Register an AWS Lambda function in the Function Discovery. + +``` +curl --request POST \ + --url http://127.0.0.1:4001/v1/functions \ + --header 'content-type: application/json' \ + --data '{"functionId": "hello", "provider":{"type": "awslambda", "arn": "", "region": "", "accessKeyId": "", "secretAccessKey": ""}}' +``` + +### Subscribe to an Event + +Once the function is register you can subscribe it to you custom event. + +``` +curl --request POST \ + --url http://127.0.0.1:4001/v1/subscriptions \ + --header 'content-type: application/json' \ + --data '{"functionId": "hello", "event": "pageVisited"}' +``` + +### Emit an Event + +An event can be emitted using [Events API](#events-api). + +``` +curl --request POST \ + --url http://127.0.0.1:4000/ \ + --header 'content-type: application/json' \ + --header 'event: pageVisited' \ + --data '{"userId": "123"}' +``` + +After emitting the event subscribed function is called asynchronously.