Skip to content

Commit d65f923

Browse files
Fix controller code guide formatting
1 parent 498a7a1 commit d65f923

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

CONTRIBUTING.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,11 +85,14 @@ Controllers expose API that can be used by the handlers. There are a couple thin
8585

8686
- be a class named `[controllerName]Controller`
8787
- use a logger to log important stuff. You can create a new logger by:
88+
8889
```javascript
8990
import Logger from 'path/to/common/logger';
9091
let logger = new Logger('[className]');
9192
```
93+
9294
- have an instance of it accessible by the `ElastalertServer`. In the `start()` function in the [`ElastalertServer`](../src/elastalert_server.js) you see
95+
9396
```javascript
9497
config.ready(function () {
9598
try {
@@ -100,10 +103,13 @@ Controllers expose API that can be used by the handlers. There are a couple thin
100103
});
101104
```
102105
You should add an instance of your controller there:
106+
103107
```javascript
104108
self._controllerNameController = new controllerName();
105109
```
110+
106111
You should also provide a getter for the controller:
112+
107113
```javascript
108114
get controllerNameController() {
109115
return this._controllerNameController;

0 commit comments

Comments
 (0)