1818- [ How to use the template] ( #how-to-use-the-template )
1919 * [ CLI] ( #cli )
2020- [ Template configuration] ( #template-configuration )
21- - [ Custom hooks that you can disable] ( #custom-hooks-that-you-can-disable )
2221- [ Development] ( #development )
2322- [ Contributors] ( #contributors )
2423
@@ -86,10 +85,14 @@ npm start
8685# for testing your server you can use mqtt client. open a new terminal and install it using:
8786npm install mqtt -g
8887
89- # publish your message.
90- mqtt pub -t ' smartylighting/streetlights/1/0/event/{streetlightId} /lighting/measured' -h ' test.mosquitto.org' -m ' {"id": 1, "lumens": 3 , "sentAt": "2017-06-07T12:34:32.000Z"}'
88+ # publish an invalid message.
89+ mqtt pub -t ' smartylighting/streetlights/1/0/event/123 /lighting/measured' -h ' test.mosquitto.org' -m ' {"id": 1, "lumens": "3" , "sentAt": "2017-06-07T12:34:32.000Z"}'
9190
92- # You should see the sent message in the logs of the previously started server.
91+ # publish a valid message
92+ mqtt pub -t ' smartylighting/streetlights/1/0/event/123/lighting/measured' -h ' test.mosquitto.org' -m ' {"id": 1, "lumens": 3, "sentAt": "2017-06-07T12:34:32.000Z"}'
93+
94+ # You should see the sent message in the logs of the previously started server.
95+ # Notice that the server automatically validates incoming messages and logs out validation errors
9396```
9497
9598
@@ -102,13 +105,6 @@ You can configure this template by passing different parameters in the Generator
102105| ---| ---| ---| ---|
103106| server| The server you want to use in the code.| Yes| ` production ` |
104107
105- ## Custom hooks that you can disable
106-
107- The functionality of this template is extended with different hooks that you can disable like this in the Generator CLI: ` -d HOOK_TYPE=HOOK_NAME `
108-
109- Type | Name | Description
110- ---|---|---
111- generate: after | createAsyncapiFile | It creates AsyncAPI file with content of the spec file passed to the generator
112108
113109## Development
114110
0 commit comments