Update the project structure

Signed-off-by: Fabio José <fabiojose@gmail.com>
This commit is contained in:
Fabio José 2018-11-14 22:44:04 -02:00
parent 942df44bbe
commit f65bcfa9dc
1 changed files with 29 additions and 4 deletions

View File

@ -8,8 +8,10 @@ Javascript SDK for CloudEvents
```text
├── index.js
├── lib
│   ├── bindings
│   │   └── http
│   │   └── structured_0_1.js
│   ├── cloudevent.js
│   ├── jsonformatter.js
│   ├── format
│   │   └── json_0_1.js
│   └── specs
@ -20,12 +22,18 @@ Javascript SDK for CloudEvents
├── README.md
└── test
├── cloudevent_spec_0_1.js
── cloudevent_spec_0_2.js
── cloudevent_spec_0_2.js
└── http_binding_0_1.js
```
* `index.js`: library exports
* `lib/bindings`: every binding implementation goes here
* `lib/bindings/http`: every http binding implementation goes here
* `lib/bindings/http/structured_0_1.js`: implementation of structured HTTP Binding
* `lib/cloudevent.js`: implementation of Cloudevent, an interface
* `lib/format/`: every format implementation goes here
@ -100,10 +108,27 @@ Every Spec class must implement these methods to work properly.
Spec(Cloudevent)
/*
* Check the spec constraints, throwing an error if do not pass.
* Checks the spec constraints, throwing an error if do not pass.
*/
Spec.check()
```
## `Binding` classes
Every Binding class must implement these methods to work properly.
```js
/*
* The constructor must receives the map of configurations.
*/
Binding(config)
/*
* Emits the event using an instance of Cloudevent.
*/
Binding.emit(cloudevent)
```
# How to use