Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

update quickstart section #294

Merged
merged 1 commit into from
Aug 17, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
56 changes: 3 additions & 53 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ Azure, Google & IBM.

## Contents

1. [Installation](#installation)
1. [Quick Start](#quick-start)
1. [Motivation](#motivation)
1. [Components](#components)
Expand All @@ -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": "<Function AWS ARN>", "region": "<Region>", "accessKeyId": "<Access Key ID>", "secretAccessKey": "<Secret Access Key>"}}'
```

### 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

Expand Down
56 changes: 56 additions & 0 deletions docs/developing.md
Original file line number Diff line number Diff line change
@@ -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": "<Function AWS ARN>", "region": "<Region>", "accessKeyId": "<Access Key ID>", "secretAccessKey": "<Secret Access Key>"}}'
```

### 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.