{"id":19042462,"url":"https://github.com/serverless/serverless-event-gateway-plugin","last_synced_at":"2025-04-23T22:28:04.702Z","repository":{"id":57140119,"uuid":"119378433","full_name":"serverless/serverless-event-gateway-plugin","owner":"serverless","description":"Event Gateway plugin for Serverless Framework","archived":false,"fork":false,"pushed_at":"2018-11-09T12:45:33.000Z","size":541,"stargazers_count":29,"open_issues_count":3,"forks_count":7,"subscribers_count":34,"default_branch":"master","last_synced_at":"2024-10-28T17:36:40.679Z","etag":null,"topics":["api-gateway","event-gateway","serverless"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/serverless.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2018-01-29T12:16:21.000Z","updated_at":"2024-07-11T01:55:36.000Z","dependencies_parsed_at":"2022-09-04T23:00:14.176Z","dependency_job_id":null,"html_url":"https://github.com/serverless/serverless-event-gateway-plugin","commit_stats":null,"previous_names":[],"tags_count":30,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/serverless%2Fserverless-event-gateway-plugin","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/serverless%2Fserverless-event-gateway-plugin/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/serverless%2Fserverless-event-gateway-plugin/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/serverless%2Fserverless-event-gateway-plugin/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/serverless","download_url":"https://codeload.github.com/serverless/serverless-event-gateway-plugin/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":223764375,"owners_count":17198610,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["api-gateway","event-gateway","serverless"],"created_at":"2024-11-08T22:37:47.504Z","updated_at":"2024-11-08T22:37:48.201Z","avatar_url":"https://github.com/serverless.png","language":"JavaScript","funding_links":[],"categories":["Serverless Framework Plugins"],"sub_categories":[],"readme":"# Event Gateway plugin for Serverless Framework\n\nServerless plugin that publishes your functions and subscriptions to Hosted Event Gateway.\n\n[![Build Status](https://travis-ci.org/serverless/serverless-event-gateway-plugin.svg?branch=master)](https://travis-ci.org/serverless/serverless-event-gateway-plugin)\n[![Known Vulnerabilities](https://snyk.io/test/github/serverless/serverless-event-gateway-plugin/badge.svg)](https://snyk.io/test/github/serverless/serverless-event-gateway-plugin)\n\n\n## Setup\n\nThis is best used with the [hosted version of the Event Gateway](https://dashboard.serverless.com/) provided by Serverless, Inc. as a fully-managed service.\n\nAfter you create an account, you'll need two things: an **Access Key** and an **Application URL**.\n\nGet an Access Key in the `Access Control` section, and save it to your clipboard:\n\n\u003cimg src=\"https://user-images.githubusercontent.com/6509926/39500460-31212824-4d7a-11e8-8333-832fe2ee8cfd.png\" width=500 /\u003e\n\n\nThen, grab the URL for one of your Applications:\n\n\u003cimg src=\"https://user-images.githubusercontent.com/6509926/39500504-a029a1f6-4d7a-11e8-806f-0f158574f9c4.png\" width=500 /\u003e\n\nFinally, save both of these to your `serverless.yml`:\n\n```yml\n# serverless.yml\n\ncustom:\n  eventgateway:\n    url: tenant-yourapp.slsgateway.com\n    accessKey: AKmyKey1234\n\n...\n```\n\nYou're all set!\n\n## Example\n\nLooking for an example to get started? Check out the [**Getting Started Example**](https://github.com/serverless/event-gateway-getting-started) to deploy your first service to the Event Gateway.\n\n## Usage\n\n1. Create a new Serverless service and change into the directory.\n\n2. Install the plugin: (needs Node version 7+)\n\n\t```bash\n\t$ npm install --save-dev @serverless/serverless-event-gateway-plugin\n\t```\n\n3. Enter the necessary plugin and config in `serverless.yml`:\n\n\t```yml\n\t# serverless.yml\n\n\tservice: my-service\n\n\tcustom:\n\t  eventTypes:\n\t    http.request:\n\t  eventgateway:\n\t    url: myorg-app.slsgateway.com\n\t    accessKey: \u003cyourkey\u003e\n\t  # To use self-hosted Event Gateway, use the following\n\t  #  url: http://localhost:4000\n\n\tplugins:\n\t  - \"@serverless/serverless-event-gateway-plugin\"\n\n\tprovider:\n\t  name: aws\n\t  runtime: python3.6\n\t  stage: dev\n\t  region: us-west-2\n\t...\n\t```\n\n4. Wire up functions with an `eventgateway` event type:\n\n\t```yml\n\t# serverless.yml\n\n\tfunctions:\n\t  hello:\n\t    handler: handler.hello\n\t    events:\n\t      - eventgateway:\n\t          type: sync\n\t          eventType: http.request\n\t          path: /hello\n\t          method: GET\n\t  goodbye:\n\t    handler: handler.goodbye\n\t    events:\n\t      - eventgateway:\n\t          type: sync\n\t          eventType: http.request\n\t          path: /goodbye\n\t          method: GET\n\t```\n\n5. Deploy, then invoke your function(s):\n\n\t  ```bash\n\t  $ sls deploy\n    ....\n\n\t  $ curl -X GET https://myspace.slsgateway.com/hello\n    ...\n\n    $ curl -X GET https://myspace.slsgateway.com/goodbye\n    ...\n\t  ```\n\n6. View your space configuration with `sls gateway dashboard`:\n\n    ```bash\n    $ sls gateway dashboard\n\n    Event Gateway\n\n     space: myspace\n     endpoint: https://myspace.slsgateway.com\n\n    Functions\n    ┌─────────────────────────────────┬───────────┬────────────────────────────────────────────────────────────────────────────────┐\n    │ Function Id                     │ Region    │ ARN                                                                            │\n    ├─────────────────────────────────┼───────────┼────────────────────────────────────────────────────────────────────────────────┤\n    │ my-service-dev-hello            │ us-east-1 │ arn:aws:lambda:us-east-1:111111111111:function:my-service-dev-hello            │\n    ├─────────────────────────────────┼───────────┼────────────────────────────────────────────────────────────────────────────────┤\n    │ my-service-dev-goodbye          │ us-east-1 │ arn:aws:lambda:us-east-1:111111111111:function:my-service-dev-goodbye          │\n    └─────────────────────────────────┴───────────┴────────────────────────────────────────────────────────────────────────────────┘\n\n    Subscriptions\n    ┌────────┬─────────────────────────────────┬────────┬───────────────────────┐\n    │ Event  │ Function ID                     │ Method │ Path                  │\n    ├────────┼─────────────────────────────────┼────────┼───────────────────────┤\n    │ http   │ my-service-dev-hello            │ GET    │ /myspace/hello        │\n    ├────────┼─────────────────────────────────┼────────┼───────────────────────┤\n    │ http   │ my-service-dev-goodbye          │ GET    │ /myspace/goodbye      │\n    └────────┴─────────────────────────────────┴────────┴───────────────────────┘\n    ```\n\n\n## Concepts\n\n**Core concepts:**\n\n- **Function:** A function is a piece of compute + logic that is ready to respond to an event. Currently, functions can be AWS Lambda functions or HTTP-accessible endpoints.\n- **Events:** Events are bits of data indicating something happened -- a user was created, a email was sent, or a client requested made an HTTP request.\n- **Subscriptions:** Events are routed to functions via subscriptions. Subscriptions may be [*synchronous* or *asynchronous*](https://github.com/serverless/event-gateway/blob/master/docs/subscription-types.md).\n\n**Event concepts:**\n\n- **HTTP Request Event:** In the Event Gateway, an [HTTP request event](https://github.com/serverless/event-gateway/blob/master/docs/api.md#http-request-event) is an event which represents raw HTTP request. It's especially helpful for building REST APIs or supporting legacy payloads.\n- **Custom Events:** All non-HTTP request events are custom events. You may have multiple functions subscribed asynchronously to the same custom event.\n\n**Auth concepts:**\n\n- **Space:** A space is a name-spacing mechanism within the Event Gateway. All functions and subscriptions in a space are completely isolated from all other spaces. When using with the hosted Event Gateway, each Application will get its own Space with a unique domain -- `https://myorg-my-app.slsgateway.com`.\n- **Access key:** The Access key is the security mechanism for a space within the hosted Event Gateway. A request must have the proper Access key to modify functions and subscriptions in a space.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fserverless%2Fserverless-event-gateway-plugin","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fserverless%2Fserverless-event-gateway-plugin","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fserverless%2Fserverless-event-gateway-plugin/lists"}