<?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: OdunayoO</title>
    <description>The latest articles on DEV Community by OdunayoO (@odunayoo_).</description>
    <link>https://dev.to/odunayoo_</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%2F85655%2Fb142991e-6568-435b-b8b5-d6217e2b9a6f.png</url>
      <title>DEV Community: OdunayoO</title>
      <link>https://dev.to/odunayoo_</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/odunayoo_"/>
    <language>en</language>
    <item>
      <title>What is AWS SQS (Simple Queue Service)?</title>
      <dc:creator>OdunayoO</dc:creator>
      <pubDate>Mon, 23 Jan 2023 16:07:20 +0000</pubDate>
      <link>https://dev.to/odunayoo_/what-is-aws-sqs-simple-queue-service-3e0b</link>
      <guid>https://dev.to/odunayoo_/what-is-aws-sqs-simple-queue-service-3e0b</guid>
      <description>&lt;p&gt;AWS SQS is a messaging queue service provided by AWS. Sometimes you can have many applications deployed on AWS, and with SQS you can easily communicate with your services.&lt;/p&gt;

&lt;p&gt;These communications may be synchronous(where your applications directly communicate with each other) or asynchronous(where you can have a middleware that connects these applications)&lt;/p&gt;

&lt;p&gt;Before we dive into the features of SQS, we need to understand some concepts.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Message: It is a blob that can contain any data&lt;/li&gt;
&lt;li&gt;Queue: You can imagine a queue as a temporary house that allows you to store messages till the messages are processed and deleted.&lt;/li&gt;
&lt;li&gt;Polling: This is a mechanism that can be used to receive messages from queues.&lt;/li&gt;
&lt;li&gt;Producer: A producer sends messages to the queue. You can have one or more producers sending messages to the queue&lt;/li&gt;
&lt;li&gt;Consumer: A consumer receives(polls) messages from the queue. You can have multiple consumers.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Features of AWS SQS
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Visibility Timeout&lt;/strong&gt;&lt;br&gt;
When a message is polled and processed by the consumer, it remains in the queue and does not get deleted automatically. While the message is being processed, SQS will set a time during which the message because invisible to other consumers, to prevent them from receiving and processing the message. By default, the visibility timeout is 30 seconds, with a minimum time of 0 seconds and a maximum time of 12 hours.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Dead-Letter Queues&lt;/strong&gt;&lt;br&gt;
So what if a message is not processed within the visibility timeout? The message goes back into the message queue and is then retried to be processed until a maximum number is reached before it is then sent to the dead-letter queue. One useful thing about DLQs is that it allows you to debug your applications easily by isolating the messages that fail to be processed.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;FIFO Queues&lt;/strong&gt;&lt;br&gt;
FIFO means First In First Out which is the order in which messages are being sent and received by the consumer. The FIFO queue supports up to 300 messages per second. If you're using FIFO queues, dead-letter queues can break the order.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Delay Queues&lt;/strong&gt;&lt;br&gt;
With delay queues, messages can be delayed before they are delivered. Any message sent to this queue would be invisible to the consumers for the duration of the delay period. By default, the minimum delay period is 0 seconds and maximum time of 15 minutes. Unlike the visibility timeout where messages are hidden until they are consumed, with delay queues the messages are hidden as soon as it is added to the queue.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  SQS Hands-On
&lt;/h3&gt;

&lt;p&gt;How to create an Amazon SQS queue from AWS console&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;on the console search for SQS&lt;/li&gt;
&lt;li&gt;click on create queue&lt;/li&gt;
&lt;li&gt;for the type you can choose the standard or FIFO queue, by default the queue is set to standard
&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--ayQv27zr--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/y1xnte3d5zgleeli239h.png" alt="standard or FIFO queue" width="880" height="479"&gt;
&lt;/li&gt;
&lt;li&gt;enter a name for your queue&lt;/li&gt;
&lt;li&gt;under Configuration, you can leave it as the default or set new values
&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--FYmVSwxT--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/7loqtm6e8ep2ndir67dy.png" alt="set Configuration" width="880" height="382"&gt;
&lt;/li&gt;
&lt;li&gt;by default AWS SQS manages server-side encryption. You can disable it or choose an encryption key&lt;/li&gt;
&lt;li&gt;you can also choose who can access your queue. For the basic option,  define who can send messages to the queue and who can receive messages from the queue. For the advanced option, the JSON object can be modified directly and custom actions can be set.&lt;/li&gt;
&lt;li&gt;you can modify the redrive allow policy (optional)&lt;/li&gt;
&lt;li&gt;you can also enable dead-letter-queue (optional)
and lastly add tags(optional)&lt;/li&gt;
&lt;li&gt;Finally, your queue has been created!!!&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--Hpiciu2j--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/d0lz0xa6b1ktxvi1nbqz.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--Hpiciu2j--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/d0lz0xa6b1ktxvi1nbqz.png" alt="queue created" width="880" height="281"&gt;&lt;/a&gt;&lt;br&gt;
You can:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;edit: modify queue&lt;/li&gt;
&lt;li&gt;delete the queue&lt;/li&gt;
&lt;li&gt;purge:  delete all the messages created&lt;/li&gt;
&lt;li&gt;send and receive message &lt;/li&gt;
&lt;/ul&gt;

&lt;h4&gt;
  
  
  How to send and receive messages
&lt;/h4&gt;

&lt;ul&gt;
&lt;li&gt;click on the send and receive message&lt;/li&gt;
&lt;li&gt;enter your message in the message body&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--PyQKgMQ1--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/nh0qfczdn938uwjdg8rn.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--PyQKgMQ1--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/nh0qfczdn938uwjdg8rn.png" alt="enter your message" width="880" height="308"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;click on send message&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--Mxng0uYM--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/th0im7pslus65ij2q5gf.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--Mxng0uYM--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/th0im7pslus65ij2q5gf.png" alt="send the message" width="880" height="271"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;scroll down to receive message&lt;/li&gt;
&lt;li&gt;click on poll for messages&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--XKn6-x48--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ion9t8w6j5jbhshddafv.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--XKn6-x48--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ion9t8w6j5jbhshddafv.png" alt="poll for messages" width="880" height="271"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;your created message should appear&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--dgNz_E_I--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/lwlpyoah30kjhng7xhit.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--dgNz_E_I--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/lwlpyoah30kjhng7xhit.png" alt="your created message should appear" width="880" height="235"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;click on the id to see more details about the message&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--4xA-t7u1--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/gulx0xk02yna9p1i58yy.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--4xA-t7u1--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/gulx0xk02yna9p1i58yy.png" alt="click on id" width="880" height="389"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;after processing and receiving the message, you can delete it manually&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--xyusobOR--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/kct40wzhs8u07q0g23tu.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--xyusobOR--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/kct40wzhs8u07q0g23tu.png" alt="delete messages manually" width="880" height="452"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Conclusion: When can you use SQS?
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;It can be used to decouple and scale services&lt;/li&gt;
&lt;li&gt;Multiple SQS queues can be used to process messages in parallel&lt;/li&gt;
&lt;li&gt;Together with AWS SNS(Simple Notification Service), SQS can be used for monitoring and creating alerts in your application&lt;/li&gt;
&lt;/ul&gt;

</description>
      <category>aws</category>
      <category>tutorial</category>
      <category>sqs</category>
      <category>cloud</category>
    </item>
    <item>
      <title>Regex: An intro</title>
      <dc:creator>OdunayoO</dc:creator>
      <pubDate>Tue, 01 Feb 2022 12:56:07 +0000</pubDate>
      <link>https://dev.to/odunayoo_/regex-an-intro-5fkd</link>
      <guid>https://dev.to/odunayoo_/regex-an-intro-5fkd</guid>
      <description>&lt;h3&gt;
  
  
  What is Regex?
&lt;/h3&gt;

&lt;p&gt;Regex is a shortened term for Regular Expression. Regex patterns are used to find, replace or search for text. These patterns may be difficult to read sometimes because they are composed of simple characters such as &lt;code&gt;/code/&lt;/code&gt; or a combination of simple and special characters, such as &lt;code&gt;/code*s/&lt;/code&gt; or &lt;code&gt;/Number (\d+)\.\d*/&lt;/code&gt;. &lt;/p&gt;

&lt;h3&gt;
  
  
  Creating a regular expression in Javascript
&lt;/h3&gt;

&lt;p&gt;You can create it with the &lt;code&gt;RegExp&lt;/code&gt; object&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;const regexp = new RegExp('pattern', 'flag(s)');
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;or using the literal method&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;const regexp = /pattern/flag(s); 
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  When can you use Regex?
&lt;/h3&gt;

&lt;p&gt;Regex can be used to perform the following actions:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;user input validation, e.g. password checker, email validation&lt;/li&gt;
&lt;li&gt;finding a  specific text from a large glob of text &lt;/li&gt;
&lt;li&gt;searching for things that match a given pattern&lt;/li&gt;
&lt;li&gt;transforming a text from one format to another&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Regex Methods in Javascript
&lt;/h3&gt;

&lt;h4&gt;
  
  
  - &lt;code&gt;regexp.test(str)&lt;/code&gt; method:
&lt;/h4&gt;

&lt;p&gt;The test method allows you to search for a match between a regex and a string. It returns a boolean, &lt;code&gt;true&lt;/code&gt; or &lt;code&gt;false&lt;/code&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;const str = 'Hello World';
const regexp = /World/;
console.log(regexp.test(str)); // true
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h4&gt;
  
  
  -  &lt;code&gt;regexp.exec(str)&lt;/code&gt; method:
&lt;/h4&gt;

&lt;p&gt;While the &lt;code&gt;test()&lt;/code&gt; method allows you to search if a pattern exists within a string, the &lt;code&gt;exec()&lt;/code&gt; method will enable you to retrieve the actual match from the string.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;const str = 'Hello World';
const regexp = /l/;
console.log(regexp.exec(str)); 
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This would only return the first match. &lt;br&gt;
&lt;code&gt;[ 'l', index: 2, input: 'Hello World', groups: undefined ]&lt;/code&gt;&lt;/p&gt;
&lt;h3&gt;
  
  
  Searching with flags
&lt;/h3&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Flags&lt;/th&gt;
&lt;th&gt;Description&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;i&lt;/td&gt;
&lt;td&gt;this flag allows all the search to be case-insensitive.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;g&lt;/td&gt;
&lt;td&gt;this performs a global search for all matches; only the first match would be retrieved if not used.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;m&lt;/td&gt;
&lt;td&gt;this allows multi-line search&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;s&lt;/td&gt;
&lt;td&gt;this allows a &lt;code&gt;.&lt;/code&gt; to match a newline character &lt;code&gt;\n&lt;/code&gt;.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;u&lt;/td&gt;
&lt;td&gt;this allows you to use Unicode-related features.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;y&lt;/td&gt;
&lt;td&gt;this performs a "sticky" search that matches starting at the current position in the target string&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;An example:&lt;br&gt;
Using the previous example, &lt;code&gt;'Hello World'&lt;/code&gt; would return &lt;code&gt;true&lt;/code&gt;, but &lt;code&gt;'Hello world'&lt;/code&gt; would return &lt;code&gt;false&lt;/code&gt; because of the case sensitivity of Regex. You can fix this with the &lt;code&gt;i&lt;/code&gt; flag so that /World/i would return true for both strings.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;const str = 'Hello World';
const str2 = 'Hello world';
const regexp = /World/i;
console.log(regexp.test(str)); // true
console.log(regexp.test(str2)); // true
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Special characters
&lt;/h3&gt;

&lt;p&gt;^ : matches the starting position within the string&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;const regexp = /^hi/;
console.log(regexp.test('hi')); // true
console.log(regexp.test('hello')); // false
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;$: matches the end position within the string&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;const regexp = /bye$/;
console.log(regexp.test('goodbye'));// true
console.log(regexp.test('welcome'));// false
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;| :&lt;code&gt;or&lt;/code&gt; operator. matches previous character &lt;code&gt;or&lt;/code&gt; next character&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;const regexp = /(hi|hello) world/;
console.log(regexp.test('hi world'));// true
console.log(regexp.test('hello world'));// true
console.log(regexp.test('bye world'));// false
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;+  : matches the previous element one or more times&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;const regexp = /groo+t/;
console.log(regexp.test('groot'));// true
console.log(regexp.test('grooooot'));// true
console.log(regexp.test('grot'));// false
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;*  : matches  the previous element zero, one or more times&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;const regexp = /groo*t/;
console.log(regexp.test('groot'));// true
console.log(regexp.test('grooooot'));// true
console.log(regexp.test('grot'));// true
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;?: matches the previous element zero or one time&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;const regexp = /groo?t/;
console.log(regexp.test('groot'));// true
console.log(regexp.test('grooooot'));// false
console.log(regexp.test('grot'));// true
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;.  : matches any single character&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;const regexp = /gr.t/;
console.log(regexp.test('grit'));// true
console.log(regexp.test('grot'));// true
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;[]: matches a range of characters&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;const regexp = /[cb]at/;
console.log(regexp.test('cat'));// true
console.log(regexp.test('bat'));// true
console.log(regexp.test('sat'));// false
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;{ x,y }: matches a specified number of occurrences of x up to y&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;const regexp = /gro{2,4}t/;
console.log(regexp.test('groooot'));// true
console.log(regexp.test('grot'));// false
console.log(regexp.test('groot'));// true
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;\ : used to escape a special character&lt;br&gt;
(): groups characters &lt;/p&gt;

&lt;p&gt;Resources:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/RegExp"&gt;https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/RegExp&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

</description>
      <category>javascript</category>
      <category>beginners</category>
    </item>
    <item>
      <title>Authentication vs Authorization</title>
      <dc:creator>OdunayoO</dc:creator>
      <pubDate>Mon, 21 Jun 2021 22:33:00 +0000</pubDate>
      <link>https://dev.to/odunayoo_/authentication-vs-authorization-2nfk</link>
      <guid>https://dev.to/odunayoo_/authentication-vs-authorization-2nfk</guid>
      <description>&lt;p&gt;As a developer, authorization and authentication are two terms that you might have come across. Although they are related, they mean different things, confusing if the basic idea is not well understood.&lt;/p&gt;

&lt;p&gt;To define it, &lt;code&gt;authentication&lt;/code&gt; answers the question, &lt;code&gt;'Who are you?'&lt;/code&gt; while &lt;code&gt;authorization&lt;/code&gt; answers the question; &lt;code&gt;'What are you allowed to do?'&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Authentication can be defined as the process of verifying that the user is whom they say they are.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;Some common examples of authentication are &lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;password authentication&lt;/li&gt;
&lt;li&gt;biometric authentication&lt;/li&gt;
&lt;li&gt;multi-factor authentication &lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;em&gt;Authorization is the process of allowing users to perform specific actions based on the permission(s) they have.&lt;/em&gt; An example is a role-based authorization. Allowing different users to perform specific actions based on their roles; user or admin.&lt;/p&gt;

&lt;p&gt;We can try to understand these concepts better with this scenario.&lt;/p&gt;

&lt;p&gt;Before you board a plane, you have to show a means of identification along with your boarding pass to show that you are whom you say you are; this is authentication. The flight attendant verifies the details you give them, and then if it matches, you are allowed to board.&lt;br&gt;
Once you have successfully boarded, you cannot tell the crew member you would like to fly the plane because you are not allowed to as a passenger. You do not have the permission and the authorization to do so. Only an authorized pilot can do so.&lt;/p&gt;

&lt;p&gt;So this explains the difference between authentication and authorization.&lt;/p&gt;

</description>
      <category>javascript</category>
    </item>
    <item>
      <title>React Context API with hooks</title>
      <dc:creator>OdunayoO</dc:creator>
      <pubDate>Sat, 01 Feb 2020 21:41:24 +0000</pubDate>
      <link>https://dev.to/odunayoo_/react-context-api-with-hooks-3io4</link>
      <guid>https://dev.to/odunayoo_/react-context-api-with-hooks-3io4</guid>
      <description>&lt;h3&gt;
  
  
  What is Context API?
&lt;/h3&gt;

&lt;blockquote&gt;
&lt;p&gt;Context provides a way to pass data through the component tree without having to pass props down manually at every level.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Since release 16.3, React has had a stable version of Context API  that can be used to easily share data across multiple components. It can be passed directly to the components that need it, thus preventing props drilling.&lt;/p&gt;

&lt;p&gt;Check out the &lt;a href="https://reactjs.org/docs/context.html#when-to-use-context"&gt;documentation&lt;/a&gt; on Context&lt;/p&gt;

&lt;h3&gt;
  
  
  Why use Context API?
&lt;/h3&gt;

&lt;p&gt;Context is mainly used when you want simple state management. Context makes you avoid props drilling. In Context, you make the parent component a provider and define the child as a consumer that directly uses props from the parent rather than the passing of props through each child component that leads up to the component where it is needed&lt;/p&gt;

&lt;h3&gt;
  
  
  Basic example demonstrating usage
&lt;/h3&gt;

&lt;p&gt;You can use context by:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Creating the context&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;First, create a new project with create-react-app.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;npx create-react-app react-context-app 
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;When the project is ready, we have to create a few files.&lt;/p&gt;

&lt;p&gt;&lt;code&gt;src/context/main.js&lt;/code&gt;&lt;br&gt;
&lt;code&gt;src/component/main.js&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;React Context is initialized with React.createContext top-level API&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;import React, { createContext } from 'react';

const AppContext = createContext();
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;code&gt;createContext&lt;/code&gt; is used to initialize the React Context. It creates the context object with the Provider and Consumer component. It takes in a default value which can only be used when a component does not have a matching Provider above its tree&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Providing the value of the context to the application
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;// src/context/main.js
import React, { createContext, useState } from "react";

const AppContext = createContext();
const AppContextProvider = ({ children }) =&amp;gt; {
  let [state, setState] = useState({
    name: "Jane Doe",
    age: 20
  });
  const incrementAge = () =&amp;gt; {
    setState(prevState =&amp;gt; ({
      ...prevState,
      age: state.age + 1
    }));
  };
  const decrementAge = () =&amp;gt; {
    setState(prevState =&amp;gt; ({
      ...prevState,
      age: state.age - 1
    }));
  };

  return (
    &amp;lt;AppContext.Provider value={{ state, incrementAge, decrementAge }}&amp;gt;
      {children}
    &amp;lt;/AppContext.Provider&amp;gt;
  );
};

export { AppContext, AppContextProvider };
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;consuming the value
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;// src/component/main.js

import React, { useContext } from "react";
import { AppContext } from "../context/main";

const AppComponent = () =&amp;gt; {
  const { state, incrementAge, decrementAge } = useContext(AppContext);
  return (
    &amp;lt;&amp;gt;
      &amp;lt;div&amp;gt;My name is {state.name}&amp;lt;/div&amp;gt;
      &amp;lt;div&amp;gt;my age is {state.age}&amp;lt;/div&amp;gt;
      &amp;lt;button onClick={incrementAge}&amp;gt;+1&amp;lt;/button&amp;gt;
      &amp;lt;button onClick={decrementAge}&amp;gt;-1&amp;lt;/button&amp;gt;
    &amp;lt;/&amp;gt;
  );
};
export default AppComponent;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;In your &lt;code&gt;App.js&lt;/code&gt; add the Provider to the app by wrapping it around the &lt;code&gt;AppComponent&lt;/code&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;// src/App.js

import React from "react";
import { AppContextProvider } from "./context/main";
import AppComponent from "./component/main";
function App() {
  return (
    &amp;lt;AppContextProvider&amp;gt;
      &amp;lt;AppComponent /&amp;gt;
    &amp;lt;/AppContextProvider&amp;gt;
  );
}

export default App;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Voila!&lt;br&gt;
&lt;iframe src="https://codesandbox.io/embed/awesome-rubin-62sc4"&gt;
&lt;/iframe&gt;
&lt;/p&gt;

</description>
      <category>react</category>
      <category>javascript</category>
    </item>
  </channel>
</rss>
