<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Valiant-Joshua Bolorunduro on Medium]]></title>
        <description><![CDATA[Stories by Valiant-Joshua Bolorunduro on Medium]]></description>
        <link>https://medium.com/@bolorundurovb?source=rss-4cf775249bce------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*lKgVXNtKwVOcxaekFiCthA.png</url>
            <title>Stories by Valiant-Joshua Bolorunduro on Medium</title>
            <link>https://medium.com/@bolorundurovb?source=rss-4cf775249bce------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sun, 29 Nov 2026 03:19:53 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@bolorundurovb/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Making API Requests in Node.JS]]></title>
            <link>https://medium.com/@bolorundurovb/making-api-requests-in-node-js-e2d1f9b1a79f?source=rss-4cf775249bce------2</link>
            <guid isPermaLink="false">https://medium.com/p/e2d1f9b1a79f</guid>
            <category><![CDATA[api]]></category>
            <category><![CDATA[web-development]]></category>
            <category><![CDATA[node]]></category>
            <category><![CDATA[request]]></category>
            <category><![CDATA[nodejs]]></category>
            <dc:creator><![CDATA[Valiant-Joshua Bolorunduro]]></dc:creator>
            <pubDate>Sun, 24 May 2020 22:28:03 GMT</pubDate>
            <atom:updated>2020-05-24T22:28:03.669Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*AvS3v4F9k4hOHZg_ynUo_g.png" /></figure><p>Communication with our server from a client-based app is very essential in web development, it helps makes our client app dynamic.Making HTTP requests is a core functionality in such apps.When it comes to node.js, there are a number of solutions both built into the language itself, and developed by the developer community. Let’s take a look at some of them.</p><p>Before moving on, make sure you have up to date versions of <a href="https://nodejs.org/en/download/">Node.js and npm installed</a> on your machine.</p><h3>HTTP — the Standard Library</h3><blockquote>With this module, you can just plug and go without installing any external dependencies.</blockquote><p>PROS:</p><ul><li>native API, there is no need to install third party modules</li><li>the response is a stream</li></ul><p>CONS:</p><ul><li>a bit verbose</li><li>the response is a stream</li><li>no support for Promises</li></ul><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fcarbon.now.sh%2Fembed%3Fbg%3Drgba%28171%252C184%252C195%252C0%29%26t%3Dseti%26wt%3Dnone%26l%3Djavascript%26ds%3Dtrue%26dsyoff%3D20px%26dsblur%3D68px%26wc%3Dtrue%26wa%3Dtrue%26pv%3D56px%26ph%3D56px%26ln%3Dfalse%26fl%3D1%26fm%3DHack%26fs%3D14px%26lh%3D133%2525%26si%3Dfalse%26es%3D2x%26wm%3Dfalse%26code%3Dconst%252520https%252520%25253D%252520require%28%2527https%2527%29%25253B%25250A%25250Ahttps.get%28%2527https%25253A%25252F%25252Fapi.bolorundurovb.com%25252Fposts%2527%25252C%252520%28resp%29%252520%25253D%25253E%252520%25257B%25250A%252520%252520let%252520data%252520%25253D%252520%2527%2527%25253B%25250A%25250A%252520%252520%25252F%25252F%252520A%252520chunk%252520of%252520data%252520has%252520been%252520recieved.%25250A%252520%252520resp.on%28%2527data%2527%25252C%252520%28chunk%29%252520%25253D%25253E%252520%25257B%25250A%252520%252520%252520%252520data%252520%25252B%25253D%252520chunk%25253B%25250A%252520%252520%25257D%29%25253B%25250A%25250A%252520%252520%25252F%25252F%252520The%252520whole%252520response%252520has%252520been%252520received.%252520Print%252520out%252520the%252520result.%25250A%252520%252520resp.on%28%2527end%2527%25252C%252520%28%29%252520%25253D%25253E%252520%25257B%25250A%252520%252520%252520%252520console.log%28JSON.parse%28data%29.explanation%29%25253B%25250A%252520%252520%25257D%29%25253B%25250A%25250A%25257D%29.on%28%252522error%252522%25252C%252520%28err%29%252520%25253D%25253E%252520%25257B%25250A%252520%252520console.log%28%252522Error%25253A%252520%252522%252520%25252B%252520err.message%29%25253B%25250A%25257D%29%25253B&amp;display_name=Carbon&amp;url=https%3A%2F%2Fcarbon.now.sh%2F%3Fbg%3Drgba%28171%25252C184%25252C195%25252C0%29%26t%3Dseti%26wt%3Dnone%26l%3Djavascript%26ds%3Dtrue%26dsyoff%3D20px%26dsblur%3D68px%26wc%3Dtrue%26wa%3Dtrue%26pv%3D56px%26ph%3D56px%26ln%3Dfalse%26fl%3D1%26fm%3DHack%26fs%3D14px%26lh%3D133%252525%26si%3Dfalse%26es%3D2x%26wm%3Dfalse%26code%3Dconst%25252520https%25252520%2525253D%25252520require%28%27https%27%29%2525253B%2525250A%2525250Ahttps.get%28%27https%2525253A%2525252F%2525252Fapi.bolorundurovb.com%2525252Fposts%27%2525252C%25252520%28resp%29%25252520%2525253D%2525253E%25252520%2525257B%2525250A%25252520%25252520let%25252520data%25252520%2525253D%25252520%27%27%2525253B%2525250A%2525250A%25252520%25252520%2525252F%2525252F%25252520A%25252520chunk%25252520of%25252520data%25252520has%25252520been%25252520recieved.%2525250A%25252520%25252520resp.on%28%27data%27%2525252C%25252520%28chunk%29%25252520%2525253D%2525253E%25252520%2525257B%2525250A%25252520%25252520%25252520%25252520data%25252520%2525252B%2525253D%25252520chunk%2525253B%2525250A%25252520%25252520%2525257D%29%2525253B%2525250A%2525250A%25252520%25252520%2525252F%2525252F%25252520The%25252520whole%25252520response%25252520has%25252520been%25252520received.%25252520Print%25252520out%25252520the%25252520result.%2525250A%25252520%25252520resp.on%28%27end%27%2525252C%25252520%28%29%25252520%2525253D%2525253E%25252520%2525257B%2525250A%25252520%25252520%25252520%25252520console.log%28JSON.parse%28data%29.explanation%29%2525253B%2525250A%25252520%25252520%2525257D%29%2525253B%2525250A%2525250A%2525257D%29.on%28%25252522error%25252522%2525252C%25252520%28err%29%25252520%2525253D%2525253E%25252520%2525257B%2525250A%25252520%25252520console.log%28%25252522Error%2525253A%25252520%25252522%25252520%2525252B%25252520err.message%29%2525253B%2525250A%2525257D%29%2525253B&amp;image=https%3A%2F%2Fcarbon.now.sh%2Fstatic%2Fbrand%2Fbanner.png&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;scroll=auto&amp;schema=carbon" width="1024" height="480" frameborder="0" scrolling="no"><a href="https://medium.com/media/f3b6a193c3cc909d9486911db78917f4/href">https://medium.com/media/f3b6a193c3cc909d9486911db78917f4/href</a></iframe><h3>Request</h3><blockquote><a href="https://github.com/request/request">Request</a> is a simplified HTTP client and is much more user friendly than the default http module and has been considered a go-to for the community for several years.Request is designed to be the simplest way possible to make http calls. It supports HTTPS and follows redirects by default.</blockquote><p><em>Note: Has been deprecated since Feb 2020</em></p><p>PROS:</p><ul><li>ease of use</li></ul><p>CONS:</p><ul><li>no Promises</li><li>too many dependencies</li></ul><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fcarbon.now.sh%2Fembed%3Fbg%3Drgba%28171%252C184%252C195%252C0%29%26t%3Dseti%26wt%3Dnone%26l%3Djavascript%26ds%3Dtrue%26dsyoff%3D20px%26dsblur%3D68px%26wc%3Dtrue%26wa%3Dtrue%26pv%3D56px%26ph%3D56px%26ln%3Dfalse%26fl%3D1%26fm%3DHack%26fs%3D14px%26lh%3D133%2525%26si%3Dfalse%26es%3D2x%26wm%3Dfalse%26code%3Dnpm%252520install%252520request&amp;display_name=Carbon&amp;url=https%3A%2F%2Fcarbon.now.sh%2F%3Fbg%3Drgba%28171%25252C184%25252C195%25252C0%29%26t%3Dseti%26wt%3Dnone%26l%3Djavascript%26ds%3Dtrue%26dsyoff%3D20px%26dsblur%3D68px%26wc%3Dtrue%26wa%3Dtrue%26pv%3D56px%26ph%3D56px%26ln%3Dfalse%26fl%3D1%26fm%3DHack%26fs%3D14px%26lh%3D133%252525%26si%3Dfalse%26es%3D2x%26wm%3Dfalse%26code%3Dnpm%25252520install%25252520request&amp;image=https%3A%2F%2Fcarbon.now.sh%2Fstatic%2Fbrand%2Fbanner.png&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;scroll=auto&amp;schema=carbon" width="1024" height="480" frameborder="0" scrolling="no"><a href="https://medium.com/media/2a6bd59f47f4e5c7a9e932fdd9477b86/href">https://medium.com/media/2a6bd59f47f4e5c7a9e932fdd9477b86/href</a></iframe><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fcarbon.now.sh%2Fembed%3Fbg%3Drgba%28171%252C184%252C195%252C0%29%26t%3Dseti%26wt%3Dnone%26l%3Djavascript%26ds%3Dtrue%26dsyoff%3D20px%26dsblur%3D68px%26wc%3Dtrue%26wa%3Dtrue%26pv%3D56px%26ph%3D56px%26ln%3Dfalse%26fl%3D1%26fm%3DHack%26fs%3D14px%26lh%3D133%2525%26si%3Dfalse%26es%3D2x%26wm%3Dfalse%26code%3Dconst%252520request%252520%25253D%252520require%28%2527request%2527%29%25253B%25250A%25250Arequest%28%2527https%25253A%25252F%25252Fapi.bolorundurovb.com%25252Fposts%2527%25252C%252520%25257B%252520json%25253A%252520true%252520%25257D%25252C%252520%28err%25252C%252520res%25252C%252520body%29%252520%25253D%25253E%252520%25257B%25250A%252520%252520if%252520%28err%29%252520%25257B%252520return%252520console.log%28err%29%25253B%252520%25257D%25250A%252520%252520console.log%28body.url%29%25253B%25250A%252520%252520console.log%28body.explanation%29%25253B%25250A%25257D%29%25253B&amp;display_name=Carbon&amp;url=https%3A%2F%2Fcarbon.now.sh%2F%3Fbg%3Drgba%28171%25252C184%25252C195%25252C0%29%26t%3Dseti%26wt%3Dnone%26l%3Djavascript%26ds%3Dtrue%26dsyoff%3D20px%26dsblur%3D68px%26wc%3Dtrue%26wa%3Dtrue%26pv%3D56px%26ph%3D56px%26ln%3Dfalse%26fl%3D1%26fm%3DHack%26fs%3D14px%26lh%3D133%252525%26si%3Dfalse%26es%3D2x%26wm%3Dfalse%26code%3Dconst%25252520request%25252520%2525253D%25252520require%28%27request%27%29%2525253B%2525250A%2525250Arequest%28%27https%2525253A%2525252F%2525252Fapi.bolorundurovb.com%2525252Fposts%27%2525252C%25252520%2525257B%25252520json%2525253A%25252520true%25252520%2525257D%2525252C%25252520%28err%2525252C%25252520res%2525252C%25252520body%29%25252520%2525253D%2525253E%25252520%2525257B%2525250A%25252520%25252520if%25252520%28err%29%25252520%2525257B%25252520return%25252520console.log%28err%29%2525253B%25252520%2525257D%2525250A%25252520%25252520console.log%28body.url%29%2525253B%2525250A%25252520%25252520console.log%28body.explanation%29%2525253B%2525250A%2525257D%29%2525253B&amp;image=https%3A%2F%2Fcarbon.now.sh%2Fstatic%2Fbrand%2Fbanner.png&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;scroll=auto&amp;schema=carbon" width="1024" height="480" frameborder="0" scrolling="no"><a href="https://medium.com/media/1e9afadc52370e42a935b5ffd51fd11d/href">https://medium.com/media/1e9afadc52370e42a935b5ffd51fd11d/href</a></iframe><h3>Axios</h3><blockquote><a href="https://github.com/mzabriskie/axios">Axios</a> is a Promise based HTTP client for the browser and node.js as seen on their site.</blockquote><p>PROS:</p><ul><li>Support for Promises</li><li>Supports protection against Cross-site request forgery, XSRF.</li></ul><p>CONS:</p><ul><li>Quite tricky to use.</li></ul><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fcarbon.now.sh%2Fembed%3Fbg%3Drgba%28171%252C184%252C195%252C0%29%26t%3Dseti%26wt%3Dnone%26l%3Djavascript%26ds%3Dtrue%26dsyoff%3D20px%26dsblur%3D68px%26wc%3Dtrue%26wa%3Dtrue%26pv%3D56px%26ph%3D56px%26ln%3Dfalse%26fl%3D1%26fm%3DHack%26fs%3D14px%26lh%3D133%2525%26si%3Dfalse%26es%3D2x%26wm%3Dfalse%26code%3Dnpm%252520install%252520axios&amp;display_name=Carbon&amp;url=https%3A%2F%2Fcarbon.now.sh%2F%3Fbg%3Drgba%28171%25252C184%25252C195%25252C0%29%26t%3Dseti%26wt%3Dnone%26l%3Djavascript%26ds%3Dtrue%26dsyoff%3D20px%26dsblur%3D68px%26wc%3Dtrue%26wa%3Dtrue%26pv%3D56px%26ph%3D56px%26ln%3Dfalse%26fl%3D1%26fm%3DHack%26fs%3D14px%26lh%3D133%252525%26si%3Dfalse%26es%3D2x%26wm%3Dfalse%26code%3Dnpm%25252520install%25252520axios&amp;image=https%3A%2F%2Fcarbon.now.sh%2Fstatic%2Fbrand%2Fbanner.png&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;scroll=auto&amp;schema=carbon" width="1024" height="480" frameborder="0" scrolling="no"><a href="https://medium.com/media/e17f187a18ebd376cfd55ab2ca0617a0/href">https://medium.com/media/e17f187a18ebd376cfd55ab2ca0617a0/href</a></iframe><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fcarbon.now.sh%2Fembed%3Fbg%3Drgba%28171%252C184%252C195%252C0%29%26t%3Dseti%26wt%3Dnone%26l%3Djavascript%26ds%3Dtrue%26dsyoff%3D20px%26dsblur%3D68px%26wc%3Dtrue%26wa%3Dtrue%26pv%3D56px%26ph%3D56px%26ln%3Dfalse%26fl%3D1%26fm%3DHack%26fs%3D14px%26lh%3D133%2525%26si%3Dfalse%26es%3D2x%26wm%3Dfalse%26code%3Dconst%252520axios%252520%25253D%252520require%28%2527axios%2527%29%25253B%25250A%25250Aaxios.get%28%2527https%25253A%25252F%25252Fapi.bolorundurovb.com%25252Fposts%2527%29%25250A%252520%252520.then%28response%252520%25253D%25253E%252520%25257B%25250A%252520%252520%252520%252520console.log%28response.data.url%29%25253B%25250A%252520%252520%252520%252520console.log%28response.data.explanation%29%25253B%25250A%252520%252520%25257D%29%25250A%252520%252520.catch%28error%252520%25253D%25253E%252520%25257B%25250A%252520%252520%252520%252520console.log%28error%29%25253B%25250A%252520%252520%25257D%29%25253B&amp;display_name=Carbon&amp;url=https%3A%2F%2Fcarbon.now.sh%2F%3Fbg%3Drgba%28171%25252C184%25252C195%25252C0%29%26t%3Dseti%26wt%3Dnone%26l%3Djavascript%26ds%3Dtrue%26dsyoff%3D20px%26dsblur%3D68px%26wc%3Dtrue%26wa%3Dtrue%26pv%3D56px%26ph%3D56px%26ln%3Dfalse%26fl%3D1%26fm%3DHack%26fs%3D14px%26lh%3D133%252525%26si%3Dfalse%26es%3D2x%26wm%3Dfalse%26code%3Dconst%25252520axios%25252520%2525253D%25252520require%28%27axios%27%29%2525253B%2525250A%2525250Aaxios.get%28%27https%2525253A%2525252F%2525252Fapi.bolorundurovb.com%2525252Fposts%27%29%2525250A%25252520%25252520.then%28response%25252520%2525253D%2525253E%25252520%2525257B%2525250A%25252520%25252520%25252520%25252520console.log%28response.data.url%29%2525253B%2525250A%25252520%25252520%25252520%25252520console.log%28response.data.explanation%29%2525253B%2525250A%25252520%25252520%2525257D%29%2525250A%25252520%25252520.catch%28error%25252520%2525253D%2525253E%25252520%2525257B%2525250A%25252520%25252520%25252520%25252520console.log%28error%29%2525253B%2525250A%25252520%25252520%2525257D%29%2525253B&amp;image=https%3A%2F%2Fcarbon.now.sh%2Fstatic%2Fbrand%2Fbanner.png&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;scroll=auto&amp;schema=carbon" width="1024" height="480" frameborder="0" scrolling="no"><a href="https://medium.com/media/ee8831a15b4a2b84040e4c36e8a922da/href">https://medium.com/media/ee8831a15b4a2b84040e4c36e8a922da/href</a></iframe><h3>SuperAgent</h3><p><a href="https://github.com/visionmedia/superagent">SuperAgent</a> is a Small progressive client-side HTTP request library, and Node.js module with the same API, supporting many high-level HTTP client features.</p><h3>Pros</h3><ul><li>It has a plugin ecosystem where plugins could be built for extra functionality.</li><li>Nice interface for making HTTP requests.</li><li>Multiple functions chaining to send requests.</li></ul><h3>Cons</h3><ul><li>It’s API doesn’t adhere to any standard.</li></ul><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fcarbon.now.sh%2Fembed%3Fbg%3Drgba%28171%252C184%252C195%252C0%29%26t%3Dseti%26wt%3Dnone%26l%3Djavascript%26ds%3Dtrue%26dsyoff%3D20px%26dsblur%3D68px%26wc%3Dtrue%26wa%3Dtrue%26pv%3D56px%26ph%3D56px%26ln%3Dfalse%26fl%3D1%26fm%3DHack%26fs%3D14px%26lh%3D133%2525%26si%3Dfalse%26es%3D2x%26wm%3Dfalse%26code%3Dnpm%252520install%252520superagent&amp;display_name=Carbon&amp;url=https%3A%2F%2Fcarbon.now.sh%2F%3Fbg%3Drgba%28171%25252C184%25252C195%25252C0%29%26t%3Dseti%26wt%3Dnone%26l%3Djavascript%26ds%3Dtrue%26dsyoff%3D20px%26dsblur%3D68px%26wc%3Dtrue%26wa%3Dtrue%26pv%3D56px%26ph%3D56px%26ln%3Dfalse%26fl%3D1%26fm%3DHack%26fs%3D14px%26lh%3D133%252525%26si%3Dfalse%26es%3D2x%26wm%3Dfalse%26code%3Dnpm%25252520install%25252520superagent&amp;image=https%3A%2F%2Fcarbon.now.sh%2Fstatic%2Fbrand%2Fbanner.png&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;scroll=auto&amp;schema=carbon" width="1024" height="480" frameborder="0" scrolling="no"><a href="https://medium.com/media/4a111c46c327561c45fceeba7e77eb25/href">https://medium.com/media/4a111c46c327561c45fceeba7e77eb25/href</a></iframe><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fcarbon.now.sh%2Fembed%3Fbg%3Drgba%28171%252C184%252C195%252C0%29%26t%3Dseti%26wt%3Dnone%26l%3Djavascript%26ds%3Dtrue%26dsyoff%3D20px%26dsblur%3D68px%26wc%3Dtrue%26wa%3Dtrue%26pv%3D56px%26ph%3D56px%26ln%3Dfalse%26fl%3D1%26fm%3DHack%26fs%3D14px%26lh%3D133%2525%26si%3Dfalse%26es%3D2x%26wm%3Dfalse%26code%3Dconst%252520superagent%252520%25253D%252520require%28%2527superagent%2527%29%25253B%25250A%25250Asuperagent.get%28%2527https%25253A%25252F%25252Fapi.bolorundurovb.com%25252Fposts%2527%29%25250A.query%28%25257B%252520api_key%25253A%252520%2527Your_Key%2527%25252C%252520date%25253A%252520%25272020-24-05%2527%252520%25257D%29%25250A.end%28%28err%25252C%252520res%29%252520%25253D%25253E%252520%25257B%25250A%252520%252520if%252520%28err%29%252520%25257B%252520return%252520console.log%28err%29%25253B%252520%25257D%25250A%252520%252520console.log%28res.body.url%29%25253B%25250A%252520%252520console.log%28res.body.explanation%29%25253B%25250A%25257D%29%25253B&amp;display_name=Carbon&amp;url=https%3A%2F%2Fcarbon.now.sh%2F%3Fbg%3Drgba%28171%25252C184%25252C195%25252C0%29%26t%3Dseti%26wt%3Dnone%26l%3Djavascript%26ds%3Dtrue%26dsyoff%3D20px%26dsblur%3D68px%26wc%3Dtrue%26wa%3Dtrue%26pv%3D56px%26ph%3D56px%26ln%3Dfalse%26fl%3D1%26fm%3DHack%26fs%3D14px%26lh%3D133%252525%26si%3Dfalse%26es%3D2x%26wm%3Dfalse%26code%3Dconst%25252520superagent%25252520%2525253D%25252520require%28%27superagent%27%29%2525253B%2525250A%2525250Asuperagent.get%28%27https%2525253A%2525252F%2525252Fapi.bolorundurovb.com%2525252Fposts%27%29%2525250A.query%28%2525257B%25252520api_key%2525253A%25252520%27Your_Key%27%2525252C%25252520date%2525253A%25252520%272020-24-05%27%25252520%2525257D%29%2525250A.end%28%28err%2525252C%25252520res%29%25252520%2525253D%2525253E%25252520%2525257B%2525250A%25252520%25252520if%25252520%28err%29%25252520%2525257B%25252520return%25252520console.log%28err%29%2525253B%25252520%2525257D%2525250A%25252520%25252520console.log%28res.body.url%29%2525253B%2525250A%25252520%25252520console.log%28res.body.explanation%29%2525253B%2525250A%2525257D%29%2525253B&amp;image=https%3A%2F%2Fcarbon.now.sh%2Fstatic%2Fbrand%2Fbanner.png&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;scroll=auto&amp;schema=carbon" width="1024" height="480" frameborder="0" scrolling="no"><a href="https://medium.com/media/71e3df40f81ed70d20de294b1fa11f4b/href">https://medium.com/media/71e3df40f81ed70d20de294b1fa11f4b/href</a></iframe><h3>Final Thoughts</h3><p>This doesn’t cover <em>all</em> of the solutions, but now you see how the basic functionality works in a few of the most popular HTTP libraries in Node. There are also libraries such as <a href="https://www.npmjs.com/package/node-fetch">node-fetch</a> which ports the browser’s fetch functionality to the backend.</p><p><em>If you enjoyed reading this article consider hitting the clap button 👏. Wanna see more of my work? Check out </em><a href="https://github.com/bolorundurovj"><em>my GitHub </em></a><em>to view my code and learn more about me on my </em><a href="https://bolorundurovb.com/"><em>website</em></a></p><p>What are your favorite ways to send HTTP requests? Feel free to reach out and let me know or ask any questions:</p><p>Twitter: @<a href="https://twitter.com/bolorundurovb">bolorundurovb</a></p><p>Instagram: @<a href="https://www.instagram.com/bolorundurovb/">bolorundurovb</a></p><p>Github: <a href="https://github.com/bolorundurovj">bolorundurovj</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=e2d1f9b1a79f" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Getting started with Node.Js]]></title>
            <link>https://medium.com/@bolorundurovb/getting-started-with-node-js-9c0b7823065?source=rss-4cf775249bce------2</link>
            <guid isPermaLink="false">https://medium.com/p/9c0b7823065</guid>
            <category><![CDATA[beginners-guide]]></category>
            <category><![CDATA[node]]></category>
            <category><![CDATA[web-development]]></category>
            <category><![CDATA[beginner]]></category>
            <category><![CDATA[nodejs]]></category>
            <dc:creator><![CDATA[Valiant-Joshua Bolorunduro]]></dc:creator>
            <pubDate>Mon, 13 Apr 2020 20:10:10 GMT</pubDate>
            <atom:updated>2020-04-24T04:13:06.569Z</atom:updated>
            <content:encoded><![CDATA[<p>In this tutorial you will learn how to setup a local server with Node.js. By the end you’ll be able to run a basic web app on your own server.</p><p>Let’s get started! 🚀</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*ve2rUXSR07sVnMNW.png" /><figcaption>Official Node.Js Logo</figcaption></figure><p><strong>What is Node.js?</strong><br>Node.js is an open source, lightweight and efficient JavaScript runtime built on Chrome’s V8 JavaScript engine.</p><p><strong>Prerequisites</strong><br>If you know JavaScript but you have never done any server-side programming before, this tutorial for you. Before you continue though, you need to have Node.js and npm installed.</p><p>You can search the web for instructions on how to install Node.js and npm for your preferred platform or visit the Node.js website (npm comes with Node). The versions I used while building this project are as follows:</p><p>Node.js v10.16.0<br>npm v6.9.0</p><p>You can view the version of Node and npm you have installed by running the following commands in your terminal:</p><pre>npm -v<br>node -v</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/695/1*U-tQZnZV7HZaU-t9TNXyHw.png" /><figcaption>node and npm version</figcaption></figure><p>A simple way to test if Node.Js is working on your system is to create a javascript file which print a message.</p><p>Let’s create a test.js file, then enter:</p><pre>//test.js<br>console.log(“Node is alive”);</pre><p>From the Command Prompt or Terminal navigate to the directory where your JS file is, the enter:</p><pre>node test.js</pre><figure><img alt="" src="https://cdn-images-1.medium.com/proxy/1*1BpxfLOli6UFUPcFQorKxw.png" /></figure><blockquote>If everything has been done right, you should have the same output as above.Now Node is installed.</blockquote><p>Now that we have installed Node.js, let’s build our first web server. Create a file named server.js containing the following contents:</p><pre>const http = require(&#39;http&#39;);<br><br>const hostname = &#39;127.0.0.1&#39;;<br>const port = 3000;<br><br>const server = http.createServer((req, res) =&gt; {<br>  res.statusCode = 200;<br>  res.setHeader(&#39;Content-Type&#39;, &#39;text/plain&#39;);<br>  res.end(&#39;Hello World&#39;);<br>});<br><br>server.listen(port, hostname, () =&gt; {<br>  console.log(`Server running at http://${hostname}:${port}/`);<br>});</pre><p>We need http to create an http server, therefore we require(&#39;http&#39;) and pass it to a variable named http</p><pre>const http = require(&#39;http&#39;);</pre><p>Next we need our localhost127.0.0.1 and port3000 to access the server.</p><pre>const hostname = &#39;127.0.0.1&#39;;<br>const port = 3000;</pre><p>Next we create the http server using the createServer method.</p><pre>const server = http.createServer((req, res) =&gt; {<br>  res.statusCode = 200;<br>  res.setHeader(&#39;Content-Type&#39;, &#39;text/plain&#39;);<br>  res.end(&#39;Hello World&#39;);<br>});</pre><blockquote><em>the function has two parameters </em><em>req and </em><em>res which is the </em><em>request from and </em><em>response to the server, respectively.</em></blockquote><p>We created the server, now we have to assign it a hostname and port number.</p><pre>server.listen(port, hostname, () =&gt; {<br>  console.log(`Server running at http://${hostname}:${port}/`);<br>});</pre><p>The server is now running, and listens to localhost on port 3000 and prints “Server running at <a href="http://127.0.0.1:3000/">http://127.0.0.1:3000/</a>&quot; in command prompt, and the browser will display “Hello World”.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/696/1*WHxIbf4HuSVfUS3ENKYAQQ.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/619/1*oosqHk6UiKMHWoP0hU1MKw.png" /></figure><p>Thanks for your time :-)</p><blockquote><em>In the meantime, a quick challenge for you: write a node application that serves multiple html files.(hint: </em><a href="https://nodejs.org/en/knowledge/HTTP/servers/how-to-serve-static-files/">https://nodejs.org/en/knowledge/HTTP/servers/how-to-serve-static-files/</a><em>)</em></blockquote><p><em>If you enjoyed reading this article consider hitting the clap button 👏. Wanna see more of my work? Check out </em><a href="https://github.com/bolorundurovj"><em>my GitHub </em></a><em>to view my code and learn more about me at </em><a href="https://bolorundurovj.github.io/"><em>https://bolorundurovj.github.io</em></a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=9c0b7823065" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>