5 JS ways to make an HTTP request
Image from https://www.pexels.com/photo/blue-skies-clouds-cut-fingers-335907/

5 JS ways to make an HTTP request

In a world of interoperabilityinternet of things and microservices, the - almost 30 years old - HTTP protocol defines a communication foundation that is widely known and implemented.

Originally designed for human-to-machine communication, this protocol also supports machine-to-machine communication through standardized concepts and interfaces:

Evolution of HTTP requests in browsers

Web browsers were the first applications implementing this protocol to access the World Wide Web.

Before AJAX was conceptualized, web pages had to be fully refreshed from the server to reflect any change. JavaScript was used for simple client manipulations. From a user experience point of view, it was OK (mostly because we had no other choices) but this limited the development of user interfaces.

Then AJAX introduced new ways to design web pages: only the new information could be fetched from the server without reloading the page. Therefore, the pages were faster, crisper and fully asynchronous.

However, each browser had its own implementation of AJAX requests (not mentioning DOM, event handling and other incompatibilities). And that's why jQuery, which was initially designed to offer a uniform API that would work identically on any browser, became so popular.

Today, the situation has changed: almost all browsers are implementing the same APIs and, consequently, modern libraries are considering browsers to be one environment only.

GPF-JS

GPF-JS obviously supports browsers and it leverages AJAX requests to implement HTTP requests in this environment. But the library is also compatible with NodeJS as well as other - less common - command line hosts:

Designing only one API that is compatible with all these hosts means to deal with each host specificities.

If you want to know more about how the library deals with the different hosts, please read the rest of the article on the JavaScript and Development blog.

要查看或添加评论,请登录

Arnaud Buchholz的更多文章

  • My JavaScript Array

    My JavaScript Array

    Freely inspired from "My Shadow" from Robert Louis Stevenson I have a little array that goes in and out with me, And…

  • REserve

    REserve

    I have not been posting lately. It's because I spent most of my spare time working on a side project that enabled lots…

  • How I learned from a crazy idea

    How I learned from a crazy idea

    According to wikipedia, a particle accelerator is a machine that uses eletromagnetic fields to propel charged particles…

  • It's about the journey...

    It's about the journey...

    ..

  • Comment ne *pas* contacter un développeur fainéant...

    Comment ne *pas* contacter un développeur fainéant...

    Je mets un point d’honneur à répondre à tous les recruteurs que me contactent. Mais, parfois, la réponse n’est pas à la…

    4 条评论
  • Test automation

    Test automation

    When building the GPF library, it is tested with 4 command line hosts: NodeJs cscript/wscript Rhino PhantomJS And at…

    1 条评论
  • Knowledge sharing as a core value

    Knowledge sharing as a core value

    When I started as a developer, a colleague shared with me this very important thought: In software engineering, there…

  • Be lazy!

    Be lazy!

    As a developer, you should be proud of your laziness and I even recommend that you maturate it. Back to my school days,…

  • Be curious!

    Be curious!

    (image from https://www.flickr.

  • Back to 2015 where I learned so much about JavaScript development

    Back to 2015 where I learned so much about JavaScript development

    First of all, I'd like to wish you a happy new year 2016! May your lives, studies, careers, projects and everything…

    1 条评论

社区洞察

其他会员也浏览了