Created
October 4, 2018 02:48
-
-
Save ganeshkbhat/638ff33746f8f48b0c41a5ddf5de9975 to your computer and use it in GitHub Desktop.
ExpressJS Series - Blocking Middlewares and Responding from the 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) { | |
| // Http request to server https://myexternalloggingserver.com/log | |
| someHTTPRequestLibrary.post('https://myexternalloggingserver.com/log', {body: req.path}) | |
| .then((data)=>{ | |
| next(); | |
| }, (err) =>{ | |
| res.status(500).send('Failed'); | |
| }); | |
| }; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment