<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: PTeamz</title>
    <description>The latest articles on DEV Community by PTeamz (@p2pteamz).</description>
    <link>https://dev.to/p2pteamz</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F915784%2F2d8887b8-fe54-49f6-868a-9675fdcf2850.jpeg</url>
      <title>DEV Community: PTeamz</title>
      <link>https://dev.to/p2pteamz</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/p2pteamz"/>
    <language>en</language>
    <item>
      <title>RedFeed: Faster RESTful Serverless API with Redis</title>
      <dc:creator>PTeamz</dc:creator>
      <pubDate>Sun, 28 Aug 2022 07:06:00 +0000</pubDate>
      <link>https://dev.to/p2pteamz/redfeed-3fkh</link>
      <guid>https://dev.to/p2pteamz/redfeed-3fkh</guid>
      <description>&lt;p&gt;RedFeed demonstrates how to use Redis caching to increase efficiency in an AWS DynamoDB powered Serverless application and make it load faster.&lt;/p&gt;

&lt;p&gt;Redis is used for caching purpose. &lt;/p&gt;

&lt;p&gt;If the API data is not frequently changing then we cache the previous API result data and on the next requests re-send the cached data from Redis.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;RedFeed's System Architecture Before using Redis:&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--SafabnLw--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/b7aeegjkla6x0j765ehb.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--SafabnLw--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/b7aeegjkla6x0j765ehb.png" alt="RedFeed's System Architecture Before using Redis" width="850" height="482"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;RedFeed's System Architecture After using Redis:&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--burJzViZ--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ib2nz3wl8hrvx0ifae3b.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--burJzViZ--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ib2nz3wl8hrvx0ifae3b.png" alt="RedFeed's System Architecture After using Redis" width="850" height="482"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;RedFeed API:&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--0gruyj-m--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/19l48hael1bhrwa3dhya.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--0gruyj-m--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/19l48hael1bhrwa3dhya.png" alt="RedFeed API Image" width="880" height="495"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Overview of My Submission
&lt;/h3&gt;

&lt;p&gt;The RedFeed project demonstrates how to use Redis to create a faster Amazon DynamoDB based RESTful API with pagination and a serverless framework Architecture.&lt;/p&gt;

&lt;p&gt;Redis is used for caching purpose. &lt;/p&gt;

&lt;p&gt;If the API data being fetched is not frequently changing then we cache the previous API result data and on the next requests re-send the cached data from Redis.&lt;/p&gt;

&lt;p&gt;The API is a seeded dataset of crypto financial transactions. A transaction API fetched will look like below.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight json"&gt;&lt;code&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="nl"&gt;"page"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="s2"&gt;""&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="nl"&gt;"currency"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="s2"&gt;""&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="nl"&gt;"country"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="s2"&gt;""&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="nl"&gt;"limit"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="s2"&gt;""&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="nl"&gt;"search"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="s2"&gt;""&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="nl"&gt;"transactions"&lt;/span&gt;&lt;span class="p"&gt;:[&lt;/span&gt;&lt;span class="w"&gt;
        &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
            &lt;/span&gt;&lt;span class="nl"&gt;"Transaction_Id"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;""&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt; 
            &lt;/span&gt;&lt;span class="nl"&gt;"By"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;""&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt; 
            &lt;/span&gt;&lt;span class="nl"&gt;"Amount"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;""&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt; 
            &lt;/span&gt;&lt;span class="nl"&gt;"Country"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;""&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt; 
            &lt;/span&gt;&lt;span class="nl"&gt;"Currency"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;""&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt; 
            &lt;/span&gt;&lt;span class="nl"&gt;"Created_At"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;""&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
            &lt;/span&gt;&lt;span class="nl"&gt;"Bitcoin_Address"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;""&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt; 
            &lt;/span&gt;&lt;span class="nl"&gt;"Updated_At"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;""&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
            &lt;/span&gt;&lt;span class="nl"&gt;"Customer_Email"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;""&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt; 
            &lt;/span&gt;&lt;span class="nl"&gt;"Customer_Id"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;""&lt;/span&gt;&lt;span class="w"&gt;
        &lt;/span&gt;&lt;span class="p"&gt;},&lt;/span&gt;&lt;span class="w"&gt;
        &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
            &lt;/span&gt;&lt;span class="nl"&gt;"Transaction_Id"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;""&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt; 
            &lt;/span&gt;&lt;span class="nl"&gt;"By"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;""&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt; 
            &lt;/span&gt;&lt;span class="nl"&gt;"Amount"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;""&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt; 
            &lt;/span&gt;&lt;span class="nl"&gt;"Country"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;""&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt; 
            &lt;/span&gt;&lt;span class="nl"&gt;"Currency"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;""&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt; 
            &lt;/span&gt;&lt;span class="nl"&gt;"Created_At"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;""&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
            &lt;/span&gt;&lt;span class="nl"&gt;"Bitcoin_Address"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;""&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt; 
            &lt;/span&gt;&lt;span class="nl"&gt;"Updated_At"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;""&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
            &lt;/span&gt;&lt;span class="nl"&gt;"Customer_Email"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;""&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt; 
            &lt;/span&gt;&lt;span class="nl"&gt;"Customer_Id"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;""&lt;/span&gt;&lt;span class="w"&gt;
        &lt;/span&gt;&lt;span class="p"&gt;}]&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;

&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;


&lt;p&gt;&lt;em&gt;Redis initialization:&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;Redis is initialized.&lt;br&gt;
&lt;/p&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;
&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;redis&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="nx"&gt;Redis&lt;/span&gt;&lt;span class="p"&gt;({&lt;/span&gt;
    &lt;span class="na"&gt;port&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;6379&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="na"&gt;host&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;127.0.0.1&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="na"&gt;tls&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{},});&lt;/span&gt;

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;


&lt;p&gt;&lt;em&gt;Redis caching:&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;Redis checks if data is already cached, then returns the cached data if available.&lt;/p&gt;

&lt;p&gt;Else, it queries the database.&lt;br&gt;
&lt;/p&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;
&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;cachedResult&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;await&lt;/span&gt; &lt;span class="nx"&gt;redis&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="kd"&gt;get&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;page&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;

&lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;cachedResult&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="nx"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;Returning cached data&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;

    &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="na"&gt;statusCode&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;200&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
        &lt;span class="na"&gt;body&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;JSON&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;stringify&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;JSON&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;parse&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;cachedResult&lt;/span&gt;&lt;span class="p"&gt;))&lt;/span&gt;
      &lt;span class="p"&gt;};&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt; 

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;


&lt;p&gt;If result is not cached, then store result with Redis.&lt;br&gt;
&lt;/p&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;
&lt;span class="k"&gt;if&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="o"&gt;!&lt;/span&gt;&lt;span class="nx"&gt;cachedResult&lt;/span&gt;&lt;span class="p"&gt;){&lt;/span&gt;
    &lt;span class="k"&gt;await&lt;/span&gt; &lt;span class="nx"&gt;redis&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="kd"&gt;set&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;page&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;resultStore&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;    
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;h3&gt;
  
  
  &lt;em&gt;Redis Performance is Faster:&lt;/em&gt;
&lt;/h3&gt;

&lt;p&gt;Using Redis to return cached data can make the application load faster which is very important when we either have a lot of data in the response or the backend takes time to send the response or we're making an API call to get data from the database.&lt;/p&gt;
&lt;h3&gt;
  
  
  &lt;em&gt;RedFeed Installation:&lt;/em&gt;
&lt;/h3&gt;

&lt;p&gt;Install the following applications on your PC before installing RedFeed.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;&lt;a href="https://nodejs.org/en/download/current/"&gt;Node.JS&lt;/a&gt;, v16.9.1 &lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Redis (For Linux Users), v7.21.1&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;a href="https://www.memurai.com/get-memurai"&gt;Memurai&lt;/a&gt; (For Windows Users), v2.0.3.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Download RedFeed:&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;First, download or clone RedFeed from Github:&lt;/p&gt;

&lt;p&gt;Go to &lt;a href="https://github.com/p2pteamz/redfeed"&gt;https://github.com/p2pteamz/redfeed&lt;/a&gt; and download or clone RedFeed.&lt;/p&gt;

&lt;p&gt;Then install Node.JS project dependency.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Install NPM dependencies:&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Open the unzipped or cloned RedFeed app folder in your favorite code editor (I use VS Code) and in the command line terminal of the project folder.&lt;/p&gt;

&lt;p&gt;Install Serverless Framework:&lt;/p&gt;

&lt;p&gt;&lt;em&gt;npm i -g serverless&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;Install Serverless Offline:&lt;/p&gt;

&lt;p&gt;&lt;em&gt;npm i -g serverless-offline&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;Install Serverless Bundle:&lt;/p&gt;

&lt;p&gt;&lt;em&gt;npm i --save-dev serverless-bundle&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;Install the app's npm dependency modules. &lt;/p&gt;

&lt;p&gt;&lt;em&gt;npm install&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;Run Serverless Offline:&lt;/p&gt;

&lt;p&gt;&lt;em&gt;serverless plugin install -n serverless-offline&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;Install DynamoDB Offline:&lt;/p&gt;

&lt;p&gt;&lt;em&gt;sls dynamodb install&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Running RedFeed:&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;You can now run the RedFeed app by executing the CLI command below.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;sls offline start&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;If the run was successful, you should see the message "Server ready: &lt;a href="http://localhost:3000"&gt;http://localhost:3000&lt;/a&gt; 🚀" in your console.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;API Navigation:&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Open your browser and visit '&lt;a href="http://localhost:3000/dev/transactions"&gt;http://localhost:3000/dev/transactions&lt;/a&gt; ' to view the raw JSON data. &lt;/p&gt;

&lt;p&gt;The RESTful URL Endpoints have the following parameters.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;GET/  dev/transactions?cur=BTC&amp;amp;cc=BW&amp;amp;lm=10&amp;amp;s=Tom&amp;amp;pg=1&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;&lt;em&gt;API Endpoint Parameter definitions:&lt;/em&gt;&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;"cur" - crypto currency type. Eligible codes: "ETH", "BTC", "LTC"&lt;/p&gt;

&lt;p&gt;"cc" - country code. Eligible codes: "US", "NG", "SA", "BW", "GH&lt;/p&gt;

&lt;p&gt;"lm" - page size limit. Integer only. Setting it to '10' means you want only 10 results per page.&lt;/p&gt;

&lt;p&gt;"s" - customer Name. String text only.&lt;/p&gt;

&lt;p&gt;"pg" - page number. Integer only.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;&lt;em&gt;Examples;&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;To get page 1 of the API, send a GET request like;&lt;/p&gt;

&lt;p&gt;GET/ &lt;a href="http://localhost:3000/dev/transactions?cur=BTC&amp;amp;cc=NG&amp;amp;lm=10&amp;amp;s=&amp;amp;pg=1"&gt;http://localhost:3000/dev/transactions?cur=BTC&amp;amp;cc=NG&amp;amp;lm=10&amp;amp;s=&amp;amp;pg=1&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;To get page 2 of the API, send a GET request like;&lt;/p&gt;

&lt;p&gt;GET/ &lt;a href="http://localhost:3000/dev/transactions?cur=BTC&amp;amp;cc=NG&amp;amp;lm=10&amp;amp;s=&amp;amp;pg=2"&gt;http://localhost:3000/dev/transactions?cur=BTC&amp;amp;cc=NG&amp;amp;lm=10&amp;amp;s=&amp;amp;pg=2&lt;/a&gt;&lt;/p&gt;
&lt;h3&gt;
  
  
  Submission Category:
&lt;/h3&gt;

&lt;p&gt;Minimalism Magicians&lt;/p&gt;
&lt;h3&gt;
  
  
  Video Explaining My Project
&lt;/h3&gt;

&lt;p&gt;&lt;iframe width="710" height="399" src="https://www.youtube.com/embed/anUyyh1qJYo"&gt;
&lt;/iframe&gt;
&lt;/p&gt;
&lt;h3&gt;
  
  
  Language Used
&lt;/h3&gt;

&lt;p&gt;Node.JS, JavaScript&lt;/p&gt;
&lt;h3&gt;
  
  
  Link to Code
&lt;/h3&gt;


&lt;div class="ltag-github-readme-tag"&gt;
  &lt;div class="readme-overview"&gt;
    &lt;h2&gt;
      &lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--566lAguM--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev.to/assets/github-logo-5a155e1f9a670af7944dd5e12375bc76ed542ea80224905ecaf878b9157cdefc.svg" alt="GitHub logo"&gt;
      &lt;a href="https://github.com/p2pteamz"&gt;
        p2pteamz
      &lt;/a&gt; / &lt;a href="https://github.com/p2pteamz/redfeed"&gt;
        redfeed
      &lt;/a&gt;
    &lt;/h2&gt;
    &lt;h3&gt;
      RedFeed demonstrates how to use Redis storage to power an AWS Serverless app.
    &lt;/h3&gt;
  &lt;/div&gt;
  &lt;div class="ltag-github-body"&gt;
    
&lt;div id="readme" class="md"&gt;
&lt;h1&gt;
RedFeed:&lt;/h1&gt;
&lt;p&gt;RedFeed demonstrates how to use Redis caching to increase efficiency in an AWS DynamoDB powered Serverless application and make it load faster.&lt;/p&gt;
&lt;br&gt;
&lt;p&gt;&lt;em&gt;RedFeed's System Architecture Before using Redis:&lt;/em&gt;&lt;/p&gt;
&lt;p&gt;&lt;a rel="noopener noreferrer" href="https://github.com/p2pteamz/redfeed/public/docs/sdb.png"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--UH6bpb7w--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://github.com/p2pteamz/redfeed/public/docs/sdb.png" alt="RedFeed's System Architecture Before using Redis"&gt;&lt;/a&gt;&lt;/p&gt;
&lt;br&gt;
&lt;p&gt;&lt;em&gt;RedFeed's System Architecture After using Redis:&lt;/em&gt;&lt;/p&gt;
&lt;p&gt;&lt;a rel="noopener noreferrer" href="https://github.com/p2pteamz/redfeed/public/docs/sda.png"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--ss-bTsZh--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://github.com/p2pteamz/redfeed/public/docs/sda.png" alt="RedFeed's System Architecture After using Redis"&gt;&lt;/a&gt;&lt;/p&gt;
&lt;br&gt;
&lt;p&gt;&lt;em&gt;RedFeed's API:&lt;/em&gt;&lt;/p&gt;
&lt;p&gt;&lt;a rel="noopener noreferrer" href="https://github.com/p2pteamz/redfeed/public/docs/page1.png"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--XPQauX5H--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://github.com/p2pteamz/redfeed/public/docs/page1.png" alt="RedFeed's API"&gt;&lt;/a&gt;&lt;/p&gt;
&lt;br&gt;
&lt;p&gt;&lt;em&gt;Video describing RedFeed:&lt;/em&gt;&lt;/p&gt;
&lt;p&gt;&lt;a href="https://www.youtube.com/watch?v=anUyyh1qJYo" rel="nofollow"&gt;&lt;img alt="RedFeed demonstrates the efficiency of using Redis in an AWS Serverless app" src="https://res.cloudinary.com/practicaldev/image/fetch/s--534aBPrh--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://github.com/p2pteamz/redfeed/public/docs/redis.png"&gt;&lt;/a&gt;&lt;/p&gt;
&lt;br&gt;
&lt;h2&gt;
How Redis is Used:&lt;/h2&gt;
&lt;p&gt;The project demonstrates how to use Redis to create a faster Amazon DynamoDB based RESTful API with pagination and a serverless framework Architecture.&lt;/p&gt;
&lt;p&gt;Redis is used for caching purpose.&lt;/p&gt;
&lt;p&gt;If the API data being fetched is not frequently changing then we cache the previous API result data and on the next requests re-send the cached data from Redis.&lt;/p&gt;
&lt;p&gt;The API is a seeded dataset of crypto financial transactions. A transaction API fetched will look like below.&lt;/p&gt;
&lt;div class="highlight highlight-source-json notranslate position-relative overflow-auto js-code-highlight"&gt;
&lt;pre&gt;{
    &lt;span class="pl-ent"&gt;"page"&lt;/span&gt;:&lt;span class="pl-s"&gt;&lt;span class="pl-pds"&gt;"&lt;/span&gt;&lt;span class="pl-pds"&gt;"&lt;/span&gt;&lt;/span&gt;
    &lt;span class="pl-ent"&gt;"currency"&lt;/span&gt;:&lt;span class="pl-s"&gt;&lt;span class="pl-pds"&gt;"&lt;/span&gt;&lt;span class="pl-pds"&gt;"&lt;/span&gt;&lt;/span&gt;,
    &lt;span class="pl-ent"&gt;"country"&lt;/span&gt;:&lt;span class="pl-s"&gt;&lt;span class="pl-pds"&gt;"&lt;/span&gt;&lt;span class="pl-pds"&gt;"&lt;/span&gt;&lt;/span&gt;,
    &lt;span class="pl-ent"&gt;"limit"&lt;/span&gt;:&lt;span class="pl-s"&gt;&lt;span class="pl-pds"&gt;"&lt;/span&gt;&lt;span class="pl-pds"&gt;"&lt;/span&gt;&lt;/span&gt;,
    &lt;span class="pl-ent"&gt;"search"&lt;/span&gt;:&lt;span class="pl-s"&gt;&lt;span class="pl-pds"&gt;"&lt;/span&gt;&lt;span class="pl-pds"&gt;"&lt;/span&gt;&lt;/span&gt;,
    &lt;span class="pl-ent"&gt;"transactions"&lt;/span&gt;:[
        {
            &lt;span class="pl-ent"&gt;"Transaction_Id"&lt;/span&gt;&lt;/pre&gt;…
&lt;/div&gt;
&lt;/div&gt;
  &lt;/div&gt;
  &lt;div class="gh-btn-container"&gt;&lt;a class="gh-btn" href="https://github.com/p2pteamz/redfeed"&gt;View on GitHub&lt;/a&gt;&lt;/div&gt;
&lt;/div&gt;



&lt;h3&gt;
  
  
  Collaborators
&lt;/h3&gt;

&lt;p&gt;Vakindu Philliam (&lt;a href="https://Github.com/VakinduPhilliam"&gt;Github&lt;/a&gt;)&lt;/p&gt;




&lt;ul&gt;
&lt;li&gt;&lt;em&gt;Check out &lt;a href="https://redis.io/docs/stack/get-started/clients/#high-level-client-libraries"&gt;Redis OM&lt;/a&gt;, client libraries for working with Redis as a multi-model database.&lt;/em&gt;&lt;/li&gt;
&lt;li&gt;&lt;em&gt;Use &lt;a href="https://redis.info/redisinsight"&gt;RedisInsight&lt;/a&gt; to visualize your data in Redis.&lt;/em&gt;&lt;/li&gt;
&lt;li&gt;&lt;em&gt;Sign up for a &lt;a href="https://redis.info/try-free-dev-to"&gt;free Redis database&lt;/a&gt;.&lt;/em&gt;&lt;/li&gt;
&lt;/ul&gt;

</description>
      <category>redishackathon</category>
      <category>javascript</category>
      <category>node</category>
      <category>aws</category>
    </item>
  </channel>
</rss>
