node.js - Promise-based node http framework? -


node frameworks work via (err, result) callbacks.

is there promise-based http framework node, healthy community , in active development (such express)?

on http client side, there new fetch api https://fetch.spec.whatwg.org/

fetch() allows make network requests similar xmlhttprequest (xhr), main difference [it] uses promises, enables simpler , cleaner api, avoiding callback hell , having remember complex api of xmlhttprequest

(https://developers.google.com/web/updates/2015/03/introduction-to-fetch)

some implementations:

here example code:

fetch('/some/url', {method: 'get'})   .then(function(response) {     // rejoice \o/   })   .catch(function(err) {     // error :-(   }); 

Comments

Popular posts from this blog

monitor web browser programmatically in Android? -

Shrink a YouTube video to responsive width -

wpf - PdfWriter.GetInstance throws System.NullReferenceException -