<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/">
    <channel>
        <title>Yi 🐍🐑</title>
        <link>https://paragraph.com/@yi-4</link>
        <description>A Tech lover lost in his 30s.</description>
        <lastBuildDate>Fri, 24 Apr 2026 20:52:28 GMT</lastBuildDate>
        <docs>https://validator.w3.org/feed/docs/rss2.html</docs>
        <generator>https://github.com/jpmonette/feed</generator>
        <language>en</language>
        <copyright>All rights reserved</copyright>
        <item>
            <title><![CDATA[cURL HTTP GET & POST with a Node.js built Server]]></title>
            <link>https://paragraph.com/@yi-4/curl-http-get-post-with-a-node-js-built-server</link>
            <guid>0GCmFXtD8SAfyBeIbbOu</guid>
            <pubDate>Tue, 18 Jan 2022 18:30:35 GMT</pubDate>
            <description><![CDATA[Recently, I have my server built with Node.js and MongoDB as the database. Here comes the structure. The server is running in Node.js. MongoDB provides the database support. So the http requests will be accepted and handled by the node.js code. Based on the request, the server will insert, delete, query, or update the data in the database. People call this RESTFUL API. Even I don’t know if there is another way to achieve this, it’s just so native to me. Once the basic server handling(API) cod...]]></description>
            <content:encoded><![CDATA[<p>Recently, I have my server built with Node.js and MongoDB as the database.</p><p>Here comes the structure. The server is running in Node.js. MongoDB provides the database support. So the http requests will be accepted and handled by the node.js code. Based on the request, the server will insert, delete, query, or update the data in the database. People call this RESTFUL API. Even I don’t know if there is another way to achieve this, it’s just so native to me.</p><p>Once the basic server handling(API) code is done, it needs to be tested.</p><p>The most native way to test it is using a browser. Yes, that’s what I use for testing if the server is running actively. I also use this to test my HTTP GET request.</p><p><strong>Then, what should I do if I need to test with POST method?</strong></p><p>Here comes cURL.</p><p>The format is like:</p><blockquote><p><code>curl -X POST -H “Content-Type: application/json” -d ‘{“key”:”val”}’ URL</code></p><p><code>-d specify the actual Data of Posting Method.</code></p><p><code>-H specify the Content Type.</code></p><p><code>-X specify the Custom Request Method.</code></p></blockquote><p>So, to send GET request, it would be like:</p><blockquote><p><code>curl -X GET URL</code></p></blockquote><p>BTW, using body-parser installed from <a target="_blank" rel="noopener noreferrer nofollow ugc" class="dont-break-out" href="https://www.npmjs.org/">npm</a>, the parser could not parse the number with leading zeros. Also, every MongoDB operation in Node.js must have a callback function.</p>]]></content:encoded>
            <author>yi-4@newsletter.paragraph.com (Yi 🐍🐑)</author>
        </item>
    </channel>
</rss>