sdk-javascript/examples/express-ex
Snyk bot 6be3b27514
fix: cloudevents from 3.2.0 to 4.0.0 (#376)
* fix: examples/express-ex/package.json to reduce vulnerabilities

The following vulnerabilities are fixed with an upgrade:
- https://snyk.io/vuln/SNYK-JS-AXIOS-1038255

* fix(examples): remove the body-parser module.

* When a structured formatted CloudEvent comes in, the body parser module does know how to parse it since the content type is not application/json, which resulted in an empty request body

Signed-off-by: Lucas Holmquist <lholmqui@redhat.com>

Co-authored-by: Lucas Holmquist <lholmqui@redhat.com>
2021-01-06 13:46:21 -05:00
..
README.md chore: Update examples to use latest sdk changes (#282) 2020-07-30 09:24:02 -04:00
index.js fix: cloudevents from 3.2.0 to 4.0.0 (#376) 2021-01-06 13:46:21 -05:00
package.json fix: cloudevents from 3.2.0 to 4.0.0 (#376) 2021-01-06 13:46:21 -05:00

README.md

Express Example

How To Start

npm start

Latest Supported Spec (v1.0)

A Structured One

Payload example

curl -X POST \
     -d'@../payload/v1/structured-event-0.json' \
     -H'Content-Type:application/cloudevents+json' \
     http://localhost:3000/

A Structured One with Extension

Payload example

curl -X POST \
     -d'@../payload/v1/structured-event-1.json' \
     -H'Content-Type:application/cloudevents+json' \
     http://localhost:3000/

A Structured One with Base64 Event Data

Payload example

curl -X POST \
     -d'@../payload/v1/structured-event-2.json' \
     -H'Content-Type:application/cloudevents+json' \
     http://localhost:3000/

A Binary One

curl -X POST \
     -d'@../payload/data-0.json' \
     -H'Content-Type:application/json' \
     -H'ce-specversion:1.0' \
     -H'ce-type:com.github.pull.create' \
     -H'ce-source:https://github.com/cloudevents/spec/pull/123' \
     -H'ce-id:45c83279-c8a1-4db6-a703-b3768db93887' \
     -H'ce-time:2019-11-06T11:17:00Z' \
     http://localhost:3000/

A Binary One with Extension

curl -X POST \
     -d'@../payload/data-0.json' \
     -H'Content-Type:application/json' \
     -H'ce-specversion:1.0' \
     -H'ce-type:com.github.pull.create' \
     -H'ce-source:https://github.com/cloudevents/spec/pull/123' \
     -H'ce-id:45c83279-c8a1-4db6-a703-b3768db93887' \
     -H'ce-time:2019-11-06T11:17:00Z' \
     -H'ce-myextension:extension value' \
     http://localhost:3000/

A Binary One with Base 64 Encoding

curl -X POST \
     -d'@../payload/data-1.txt' \
     -H'Content-Type:application/json' \
     -H'ce-specversion:1.0' \
     -H'ce-type:com.github.pull.create' \
     -H'ce-source:https://github.com/cloudevents/spec/pull/123' \
     -H'ce-id:45c83279-c8a1-4db6-a703-b3768db93887' \
     -H'ce-time:2019-11-06T11:17:00Z' \
     http://localhost:3000/

Spec v0.3

A Structured One

Payload example

curl -X POST \
     -d'@../payload/v03/structured-event-0.json' \
     -H'Content-Type:application/cloudevents+json' \
     http://localhost:3000/

A Structured One with Extension

Payload example

curl -X POST \
     -d'@../payload/v03/structured-event-1.json' \
     -H'Content-Type:application/cloudevents+json' \
     http://localhost:3000/

A Structured One with Base64 Event Data

Payload example

curl -X POST \
     -d'@../payload/v03/structured-event-2.json' \
     -H'Content-Type:application/cloudevents+json' \
     http://localhost:3000/

A Binary One

curl -X POST \
     -d'@../payload/data-0.json' \
     -H'Content-Type:application/json' \
     -H'ce-specversion:0.3' \
     -H'ce-type:com.github.pull.create' \
     -H'ce-source:https://github.com/cloudevents/spec/pull/123' \
     -H'ce-id:45c83279-c8a1-4db6-a703-b3768db93887' \
     -H'ce-time:2019-06-21T17:31:00Z' \
     http://localhost:3000/

A Binary One with Extension

curl -X POST \
     -d'@../payload/data-0.json' \
     -H'Content-Type:application/json' \
     -H'ce-specversion:0.3' \
     -H'ce-type:com.github.pull.create' \
     -H'ce-source:https://github.com/cloudevents/spec/pull/123' \
     -H'ce-id:45c83279-c8a1-4db6-a703-b3768db93887' \
     -H'ce-time:2019-06-21T17:31:00Z' \
     -H'ce-myextension:extension value' \
     http://localhost:3000/

A Binary One with Base 64 Encoding

curl -X POST \
     -d'@../payload/data-1.txt' \
     -H'Content-Type:application/json' \
     -H'ce-specversion:0.3' \
     -H'ce-type:com.github.pull.create' \
     -H'ce-source:https://github.com/cloudevents/spec/pull/123' \
     -H'ce-id:45c83279-c8a1-4db6-a703-b3768db93887' \
     -H'ce-time:2019-06-21T17:31:00Z' \
     -H'ce-datacontentencoding:base64' \
     http://localhost:3000/