Skip to content

Commit 83c36f1

Browse files
committed
linting
1 parent 9b38a50 commit 83c36f1

File tree

1 file changed

+17
-17
lines changed

1 file changed

+17
-17
lines changed

demos/multiple-hooks.js

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -3,34 +3,34 @@
33
const gateway = require('./../index')
44
const PORT = process.env.PORT || 8080
55

6-
const { multipleHooks } = require('fg-multiple-hooks');
6+
const { multipleHooks } = require('fg-multiple-hooks')
77

88
const hook1 = async (req, res) => {
9-
console.log('hook1 with logic 1 called');
10-
// res.send('hook failed here');
11-
return false; // do not abort the request
12-
};
9+
console.log('hook1 with logic 1 called')
10+
// res.send('hook failed here');
11+
return false // do not abort the request
12+
}
1313

1414
const hook2 = async (req, res) => {
15-
console.log('hook2 with logic 2 called');
16-
const shouldAbort = true;
17-
if (shouldAbort) {
18-
res.send('handle a rejected request here');
19-
}
20-
return shouldAbort;
15+
console.log('hook2 with logic 2 called')
16+
const shouldAbort = true
17+
if (shouldAbort) {
18+
res.send('handle a rejected request here')
19+
}
20+
return shouldAbort
2121
}
2222

2323
gateway({
2424
routes: [{
2525
prefix: '/service',
2626
target: 'http://127.0.0.1:3000',
2727
hooks: {
28-
onRequest: (req, res) => multipleHooks(req, res, hook1, hook2), // you can add as many hooks as you please
29-
onResponse (req, res, stream) {
30-
// you can alter the origin response and remote response here
31-
// default implementation explained here:
32-
// https://www.npmjs.com/package/fast-gateway#onresponse-hook-default-implementation
33-
}
28+
onRequest: (req, res) => multipleHooks(req, res, hook1, hook2), // you can add as many hooks as you please
29+
onResponse (req, res, stream) {
30+
// you can alter the origin response and remote response here
31+
// default implementation explained here:
32+
// https://www.npmjs.com/package/fast-gateway#onresponse-hook-default-implementation
33+
}
3434
}
3535
}]
3636
}).start(PORT).then(server => {

0 commit comments

Comments
 (0)