Created
October 4, 2018 02:46
-
-
Save ganeshkbhat/7ed31a21ad33c97b9cc0d0db319949d5 to your computer and use it in GitHub Desktop.
ExpressJS Series: Non-blocking middleware
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| const myFirstMiddleware = function(req, res, next) { | |
| someHTTPRequestLibraryOrPUBSUBLibrary.postOrRequest('https://myexternalloggingserver.com/log', {body: req.path}) | |
| .then((data)=>{ | |
| console.log('Sent to logging server', data); | |
| }, (err) =>{ | |
| console.log('Error Occured, log err to local file', err); | |
| }) | |
| next(); | |
| }; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment