<?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: Nitesh Sawant</title>
    <description>The latest articles on DEV Community by Nitesh Sawant (@ns23).</description>
    <link>https://dev.to/ns23</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%2F52211%2F47ffd902-deaa-4755-8498-8a7b23418cb9.jpeg</url>
      <title>DEV Community: Nitesh Sawant</title>
      <link>https://dev.to/ns23</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/ns23"/>
    <language>en</language>
    <item>
      <title>Supercharge Your Strapi CMS Setup ⚡</title>
      <dc:creator>Nitesh Sawant</dc:creator>
      <pubDate>Tue, 06 Apr 2021 07:24:40 +0000</pubDate>
      <link>https://dev.to/ns23/supercharge-your-strapi-cms-setup-579c</link>
      <guid>https://dev.to/ns23/supercharge-your-strapi-cms-setup-579c</guid>
      <description>&lt;h2&gt;
  
  
  Introduction
&lt;/h2&gt;

&lt;p&gt;In this tutorial, I am going to share few tips which will help a developer ease backend development.&lt;/p&gt;

&lt;h2&gt;
  
  
  1️⃣ Improve Eslint configuration
&lt;/h2&gt;

&lt;p&gt;By default when we create a project with &lt;code&gt;npx create-strapi-app my-project --quickstart&lt;/code&gt; the &lt;code&gt;.eslintrc&lt;/code&gt; uses &lt;code&gt;"extends": "eslint:recommended",&lt;/code&gt;, which I found does not enforces rules strictly.&lt;/p&gt;

&lt;p&gt;Alternative is to use &lt;a href="https://github.com/google/eslint-config-google" rel="noopener noreferrer"&gt;eslint-config-google&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Install below packages
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt; npm i &lt;span class="nt"&gt;-D&lt;/span&gt; eslint eslint-config-google babel-eslint
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;h3&gt;
  
  
  Update &lt;code&gt;.eslintrc&lt;/code&gt;
&lt;/h3&gt;


&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight json"&gt;&lt;code&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"parser"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"babel-eslint"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"extends"&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="s2"&gt;"eslint:recommended"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"google"&lt;/span&gt;&lt;span class="p"&gt;],&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"env"&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;"commonjs"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="kc"&gt;true&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="nl"&gt;"es6"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="kc"&gt;true&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="nl"&gt;"node"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="kc"&gt;true&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="nl"&gt;"browser"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="kc"&gt;false&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="nl"&gt;"jest"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="kc"&gt;true&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;"parserOptions"&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;"ecmaFeatures"&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;"experimentalObjectRestSpread"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="kc"&gt;true&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
      &lt;/span&gt;&lt;span class="nl"&gt;"jsx"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="kc"&gt;false&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
      &lt;/span&gt;&lt;span class="nl"&gt;"impliedStrict"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="kc"&gt;true&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;"sourceType"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"module"&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;"globals"&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;"strapi"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="kc"&gt;true&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;"rules"&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;"indent"&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="s2"&gt;"error"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="mi"&gt;2&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;"SwitchCase"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="mi"&gt;1&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;"linebreak-style"&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="s2"&gt;"off"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"unix"&lt;/span&gt;&lt;span class="p"&gt;],&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="nl"&gt;"no-console"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"error"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="nl"&gt;"quotes"&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="s2"&gt;"error"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"single"&lt;/span&gt;&lt;span class="p"&gt;],&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="nl"&gt;"semi"&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="s2"&gt;"error"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"always"&lt;/span&gt;&lt;span class="p"&gt;],&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="nl"&gt;"no-var"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"error"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="nl"&gt;"eqeqeq"&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="s2"&gt;"error"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"always"&lt;/span&gt;&lt;span class="p"&gt;],&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="nl"&gt;"object-curly-spacing"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"off"&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;h2&gt;
  
  
  2️⃣ Add Prettier
&lt;/h2&gt;
&lt;h3&gt;
  
  
  Install Prettier as Dev dependency
&lt;/h3&gt;


&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;npm i &lt;span class="nt"&gt;-D&lt;/span&gt; prettier
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;h3&gt;
  
  
  Create &lt;code&gt;.prettierrc&lt;/code&gt; file
&lt;/h3&gt;


&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight json"&gt;&lt;code&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"semi"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="kc"&gt;true&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"trailingComma"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"es5"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"singleQuote"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="kc"&gt;true&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"printWidth"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="mi"&gt;70&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;h3&gt;
  
  
  Create &lt;code&gt;.prettierignore&lt;/code&gt; file
&lt;/h3&gt;

&lt;blockquote&gt;
&lt;p&gt;copy the content of the file in the &lt;a href="https://raw.githubusercontent.com/ns23/strapi-template/main/.prettierignore" rel="noopener noreferrer"&gt;link&lt;/a&gt;&lt;/p&gt;
&lt;/blockquote&gt;


&lt;h2&gt;
  
  
  3️⃣ Enable Unit testing with Jest
&lt;/h2&gt;

&lt;blockquote&gt;
&lt;p&gt;Follow the tutorial link in official strapi docs &lt;a href="https://strapi.io/documentation/developer-docs/latest/guides/unit-testing.html#testing-auth-endpoint-controller" rel="noopener noreferrer"&gt;Link&lt;/a&gt;&lt;/p&gt;
&lt;/blockquote&gt;
&lt;h3&gt;
  
  
  Add jest configuration in &lt;code&gt;package.json&lt;/code&gt;
&lt;/h3&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="nl"&gt;"scripts"&lt;/span&gt;&lt;span class="p"&gt;:{&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="nl"&gt;"test"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"jest --forceExit --detectOpenHandles"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="nl"&gt;"coverage"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"jest --coverage --forceExit --detectOpenHandles"&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="err"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"jest"&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;"testPathIgnorePatterns"&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="s2"&gt;"/node_modules/"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
      &lt;/span&gt;&lt;span class="s2"&gt;".tmp"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
      &lt;/span&gt;&lt;span class="s2"&gt;".cache"&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;"testEnvironment"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"node"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="nl"&gt;"collectCoverage"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="kc"&gt;false&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="nl"&gt;"collectCoverageFrom"&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="s2"&gt;"api/**/*.js"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
      &lt;/span&gt;&lt;span class="s2"&gt;"config/functions/**/*.js"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
      &lt;/span&gt;&lt;span class="s2"&gt;"config/policies/**/*.js"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
      &lt;/span&gt;&lt;span class="s2"&gt;"extensions/**/*.js"&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;"coverageThreshold"&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;"global"&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;"branches"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="mi"&gt;70&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
        &lt;/span&gt;&lt;span class="nl"&gt;"functions"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="mi"&gt;70&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
        &lt;/span&gt;&lt;span class="nl"&gt;"lines"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="mi"&gt;70&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
        &lt;/span&gt;&lt;span class="nl"&gt;"statements"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="mi"&gt;70&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;h2&gt;
  
  
  4️⃣ Use Husky to add a pre-commit hook
&lt;/h2&gt;

&lt;p&gt;With husky, we can add pre-commit hooks to check for any linting issues and apply prettier formatting before committing changes to git.&lt;/p&gt;
&lt;h3&gt;
  
  
  Install Husky
&lt;/h3&gt;


&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;npm i &lt;span class="nt"&gt;-D&lt;/span&gt; husky
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;h3&gt;
  
  
  update package.json
&lt;/h3&gt;


&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight json"&gt;&lt;code&gt;&lt;span class="nl"&gt;"scripts"&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;"eslint-fix"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"eslint . --fix"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="nl"&gt;"eslint"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"eslint ."&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="nl"&gt;"lint"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"prettier --check ."&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="nl"&gt;"format"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"prettier --write ."&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="err"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"husky"&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;"hooks"&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;"pre-commit"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"lint-staged"&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="err"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"lint-staged"&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;"*"&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="s2"&gt;"eslint --fix"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
      &lt;/span&gt;&lt;span class="s2"&gt;"prettier --write"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
      &lt;/span&gt;&lt;span class="s2"&gt;"git add"&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="err"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;h2&gt;
  
  
  5️⃣ Add bitbucket build pipeline
&lt;/h2&gt;

&lt;p&gt;Here a build pipeline is used to make sure code passes certain before it can be merged.&lt;/p&gt;
&lt;h3&gt;
  
  
  Create &lt;code&gt;bitbucket-pipelines.yml&lt;/code&gt; and copy below code
&lt;/h3&gt;


&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight yaml"&gt;&lt;code&gt;&lt;span class="c1"&gt;#  Template NodeJS build&lt;/span&gt;

&lt;span class="c1"&gt;#  This template allows you to validate your NodeJS code.&lt;/span&gt;
&lt;span class="c1"&gt;#  The workflow allows running tests and code linting on the default branch.&lt;/span&gt;

&lt;span class="na"&gt;image&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;node:12.4.0&lt;/span&gt;

&lt;span class="na"&gt;pipelines&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
  &lt;span class="na"&gt;default&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
    &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="na"&gt;step&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
        &lt;span class="na"&gt;name&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;Code linting&lt;/span&gt;
        &lt;span class="na"&gt;script&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
          &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="s"&gt;npm install eslint babel-eslint eslint-config-google&lt;/span&gt;
          &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="s"&gt;npx eslint .&lt;/span&gt;
        &lt;span class="na"&gt;caches&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
          &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="s"&gt;node&lt;/span&gt;
  &lt;span class="na"&gt;pull-requests&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
    &lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="s"&gt;**"&lt;/span&gt;&lt;span class="err"&gt;:&lt;/span&gt;
      &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="na"&gt;step&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
          &lt;span class="na"&gt;name&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;Build and Test&lt;/span&gt;
          &lt;span class="na"&gt;caches&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
            &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="s"&gt;node&lt;/span&gt;
          &lt;span class="na"&gt;script&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
            &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="s"&gt;npm install&lt;/span&gt;
            &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="s"&gt;npm run coverage&lt;/span&gt;
            &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="na"&gt;pipe&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;atlassian/slack-notify:1.0.0&lt;/span&gt;
              &lt;span class="na"&gt;variables&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
                &lt;span class="na"&gt;WEBHOOK_URL&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;$WEBHOOK_URL&lt;/span&gt;
                &lt;span class="na"&gt;MESSAGE&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="s"&gt;Pull&lt;/span&gt;&lt;span class="nv"&gt; &lt;/span&gt;&lt;span class="s"&gt;request&lt;/span&gt;&lt;span class="nv"&gt; &lt;/span&gt;&lt;span class="s"&gt;build"&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  6️⃣ Create &lt;code&gt;server.js&lt;/code&gt;
&lt;/h2&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;strapi&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;require&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;strapi&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;

&lt;span class="nf"&gt;strapi&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="cm"&gt;/* {...} */&lt;/span&gt;&lt;span class="p"&gt;).&lt;/span&gt;&lt;span class="nf"&gt;start&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;




&lt;p&gt;I have created a template repo with all the changes above,it can be accessed at &lt;/p&gt;


&lt;div class="ltag-github-readme-tag"&gt;
  &lt;div class="readme-overview"&gt;
    &lt;h2&gt;
      &lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev.to%2Fassets%2Fgithub-logo-5a155e1f9a670af7944dd5e12375bc76ed542ea80224905ecaf878b9157cdefc.svg" alt="GitHub logo"&gt;
      &lt;a href="https://github.com/ns23" rel="noopener noreferrer"&gt;
        ns23
      &lt;/a&gt; / &lt;a href="https://github.com/ns23/strapi-template" rel="noopener noreferrer"&gt;
        strapi-template
      &lt;/a&gt;
    &lt;/h2&gt;
    &lt;h3&gt;
      
    &lt;/h3&gt;
  &lt;/div&gt;
  &lt;div class="ltag-github-body"&gt;
    
&lt;div id="readme" class="md"&gt;
&lt;div class="markdown-heading"&gt;
&lt;h1 class="heading-element"&gt;Strapi CMS Supercharged&lt;/h1&gt;

&lt;/div&gt;

&lt;p&gt;A quick description of your strapi application&lt;/p&gt;

&lt;/div&gt;
&lt;br&gt;
&lt;br&gt;
  &lt;/div&gt;
&lt;br&gt;
  &lt;div class="gh-btn-container"&gt;&lt;a class="gh-btn" href="https://github.com/ns23/strapi-template" rel="noopener noreferrer"&gt;View on GitHub&lt;/a&gt;&lt;/div&gt;
&lt;br&gt;
&lt;/div&gt;
&lt;br&gt;


&lt;p&gt;Please share your tips and tricks that you use to ease development in strapi.&lt;/p&gt;

&lt;p&gt;Thanks for reading, I appreciate it! Have a good day.&lt;/p&gt;

</description>
      <category>node</category>
      <category>javascript</category>
      <category>backend</category>
      <category>strapi</category>
    </item>
    <item>
      <title>Firebase - Remove Obsolete FCM Tokens in Node JS. </title>
      <dc:creator>Nitesh Sawant</dc:creator>
      <pubDate>Tue, 29 Dec 2020 17:23:18 +0000</pubDate>
      <link>https://dev.to/ns23/firebase-remove-obsolete-fcm-tokens-in-node-js-4n98</link>
      <guid>https://dev.to/ns23/firebase-remove-obsolete-fcm-tokens-in-node-js-4n98</guid>
      <description>&lt;h2&gt;
  
  
  What is FCM ?
&lt;/h2&gt;

&lt;p&gt;Firebase Cloud Messaging (FCM) is a cross-platform messaging solution that lets you reliably send messages at no cost.&lt;/p&gt;

&lt;h2&gt;
  
  
  How FCM is used with Node JS .
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Usually an mobile application  or browser registers itself to with FCM and  FCM gives that device an unique token.&lt;/li&gt;
&lt;li&gt;The Device then sends this token ton Node JS server.&lt;/li&gt;
&lt;li&gt;Node JS server stores that FCM token in database.&lt;/li&gt;
&lt;li&gt;Now whenever user needs to be notified . Server using package &lt;a href="https://www.npmjs.com/package/firebase"&gt;Firebase&lt;/a&gt;, Sends push notification to the user.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  The Problem
&lt;/h2&gt;

&lt;p&gt;The problem starts to arise when the FCM tokens expire. It can happen in below cases.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;User deletes the app without logging out.&lt;/li&gt;
&lt;li&gt;User dont use the app for long time.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;So this Obsolete tokens stays in the database and it takes up the space. In  cases where user can log in into multiple devices. In backend if user needs to be notified some action to all the devices , In most of the  push notification are triggered to Obsolete tokens.&lt;/p&gt;

&lt;h2&gt;
  
  
  The Solution
&lt;/h2&gt;

&lt;p&gt;The  Solution here is to run a cron job , may be once a week . Send a Dry push notification  and check  if the tokens throws any error .If there is any error it means the Token is obsolete and we can safety delete the token from database.&lt;/p&gt;

&lt;h2&gt;
  
  
  The Code
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight jsx"&gt;&lt;code&gt;&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;admin&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;require&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;firebase-admin&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;

&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;serviceAccount&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;require&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;`./google-services.json`&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;

&lt;span class="nx"&gt;admin&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;initializeApp&lt;/span&gt;&lt;span class="p"&gt;({&lt;/span&gt;
  &lt;span class="na"&gt;credential&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;admin&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;credential&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;cert&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;serviceAccount&lt;/span&gt;&lt;span class="p"&gt;),&lt;/span&gt;
  &lt;span class="c1"&gt;// databaseURL: 'https://marioplan-17d32.firebaseio.com'&lt;/span&gt;
&lt;span class="p"&gt;});&lt;/span&gt;

&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;verifyToken&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;async&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;token&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;message&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="na"&gt;data&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
      &lt;span class="na"&gt;score&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;850&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
      &lt;span class="na"&gt;time&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;2:45&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="p"&gt;},&lt;/span&gt;
    &lt;span class="nx"&gt;token&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="p"&gt;};&lt;/span&gt;
  &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="nx"&gt;admin&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;messaging&lt;/span&gt;&lt;span class="p"&gt;().&lt;/span&gt;&lt;span class="nx"&gt;send&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;message&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="kc"&gt;true&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="p"&gt;};&lt;/span&gt;

&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;allTokens&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;allTokensFromDB&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;

&lt;span class="k"&gt;for&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="kd"&gt;let&lt;/span&gt; &lt;span class="nx"&gt;index&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="nx"&gt;index&lt;/span&gt; &lt;span class="o"&gt;&amp;lt;&lt;/span&gt; &lt;span class="nx"&gt;allTokens&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;length&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="nx"&gt;index&lt;/span&gt;&lt;span class="o"&gt;++&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;element&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;allTokens&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="nx"&gt;index&lt;/span&gt;&lt;span class="p"&gt;];&lt;/span&gt;
  &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nx"&gt;id&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;token&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;element&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="k"&gt;try&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;verifyToken&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;token&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;catch&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;error&lt;/span&gt;&lt;span class="p"&gt;)&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;error&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;code&lt;/span&gt; &lt;span class="o"&gt;===&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;messaging/registration-token-not-registered&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt; &lt;span class="o"&gt;||&lt;/span&gt;
      &lt;span class="nx"&gt;error&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;code&lt;/span&gt; &lt;span class="o"&gt;===&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;messaging/invalid-argument&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;
    &lt;span class="p"&gt;)&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;deleteTokenFromDB&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;id&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;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;blockquote&gt;
&lt;p&gt;Run Above code Snippet as CRON job.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;&lt;a href="https://i.giphy.com/media/5bivKwxhVzshNk2Rjw/giphy.gif" class="article-body-image-wrapper"&gt;&lt;img src="https://i.giphy.com/media/5bivKwxhVzshNk2Rjw/giphy.gif" alt="https://media.giphy.com/media/5bivKwxhVzshNk2Rjw/giphy.gif"&gt;&lt;/a&gt;&lt;/p&gt;

</description>
      <category>node</category>
      <category>javascript</category>
      <category>firebase</category>
      <category>fcm</category>
    </item>
    <item>
      <title>5 GitHub Repos for creating Resumes</title>
      <dc:creator>Nitesh Sawant</dc:creator>
      <pubDate>Mon, 28 Dec 2020 18:06:28 +0000</pubDate>
      <link>https://dev.to/ns23/5-github-repos-for-creating-resumes-e3k</link>
      <guid>https://dev.to/ns23/5-github-repos-for-creating-resumes-e3k</guid>
      <description>&lt;p&gt;There is a chapter in the book &lt;a href="https://www.amazon.in/Soft-Skills-software-developers-manual/dp/1617292397"&gt;Soft Skills: The software developer's life manual&lt;/a&gt; which says a resume is like an advertising brochure. The advertisement is trying to get a hiring manager to fork over $60,000, $80,000, or more to rent a software developer for a year. And most cases our resumes are not up to the mark as we are not professional resume writers.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Why write a resume when we can code it. &lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;I have curated five fantastic Github repositories that can be modified easily to create your Resume/CV.&lt;/p&gt;

&lt;h2&gt;
  
  
  1. salomonelli/best-resume-ever
&lt;/h2&gt;

&lt;p&gt;GitHub stars: 89,300&lt;br&gt;
&lt;a href="https://github.com/salomonelli/best-resume-ever"&gt;Link&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;👔 💼 Build fast 🚀 and easy multiple beautiful resumes and create your best CV ever! Made with Vue and LESS&lt;/p&gt;

&lt;h2&gt;
  
  
  2. sharu725/online-cv
&lt;/h2&gt;

&lt;p&gt;GitHub stars: 1512&lt;br&gt;
&lt;a href="https://github.com/sharu725/online-cv"&gt;Link&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;It's A minimal Jekyll Theme to host your resume (CV). Edit &lt;code&gt;data.yml&lt;/code&gt;  and add your information. it can be hosted easily on Github pages / Netlify.&lt;/p&gt;

&lt;h2&gt;
  
  
  3. jsonresume/resume-cli
&lt;/h2&gt;

&lt;p&gt;GitHub stars: 3680&lt;br&gt;
&lt;a href="https://github.com/jsonresume/resume-cli"&gt;Link&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://jsonresume.org/"&gt;JSON Resume&lt;/a&gt; is a community-driven open-source initiative to create a JSON-based standard for resumes. The advantage here is that once a JSON is created we can any theme from over 250+ packages listed on npm.&lt;/p&gt;

&lt;h2&gt;
  
  
  4. WebPraktikos/universal-resume
&lt;/h2&gt;

&lt;p&gt;GitHub stars: 1300&lt;br&gt;
&lt;a href="https://github.com/WebPraktikos/universal-resume"&gt;Link&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Minimal and formal résumé (CV) website template for print, mobile, and desktop. It's built with amazing Tailwind CSS.&lt;/p&gt;

&lt;h2&gt;
  
  
  5. elipapa/markdown-cv
&lt;/h2&gt;

&lt;p&gt;GitHub stars: 672&lt;br&gt;
&lt;a href="https://github.com/elipapa/markdown-cv"&gt;Link&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;It's a simple template to write your CV in a readable markdown file and use CSS to publish/print it.&lt;/p&gt;

&lt;h2&gt;
  
  
  Tips
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Check the forks of the repo, to see how other developers have used the template to create their resumes.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Host your resume on Github Pages&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;When a resume is created in Jekyll, It a little difficult to create a pdf of resume. use &lt;a href="https://www.sejda.com/html-to-pdf"&gt;www.sejda.com/html-to-pdf&lt;/a&gt; to convert HTML to PDF without any watermark.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

</description>
      <category>github</category>
      <category>career</category>
      <category>resume</category>
      <category>tips</category>
    </item>
    <item>
      <title>Is it common for developer to loose passion to learn new things ?</title>
      <dc:creator>Nitesh Sawant</dc:creator>
      <pubDate>Fri, 25 Sep 2020 15:05:15 +0000</pubDate>
      <link>https://dev.to/ns23/is-it-common-for-developer-to-loose-passion-to-learn-new-things-3nkk</link>
      <guid>https://dev.to/ns23/is-it-common-for-developer-to-loose-passion-to-learn-new-things-3nkk</guid>
      <description>&lt;p&gt;When I started my career as a software developer. I found myself in front of a vast ocean of knowledge. And I had that drive to learn as many things as possible. I wanted to..&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Change the world, one line of code at a time.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Now fast forward to 2020.It feels like I have lost that drive. I am finding it difficult to focus on learning new things and frequently procrastinating on my side projects.&lt;/p&gt;

&lt;p&gt;Do most of the developer go through such phase ? What &lt;br&gt;
are the possible reason a developer ends up in such situation?&lt;/p&gt;

&lt;p&gt;And most important how one can overcome this phase ?&lt;/p&gt;

&lt;p&gt;&lt;a href="https://i.giphy.com/media/xT1R9KOVFHgympU5qg/giphy.gif" class="article-body-image-wrapper"&gt;&lt;img src="https://i.giphy.com/media/xT1R9KOVFHgympU5qg/giphy.gif" alt="Help"&gt;&lt;/a&gt;&lt;/p&gt;

</description>
      <category>discuss</category>
      <category>help</category>
      <category>productivity</category>
    </item>
    <item>
      <title>Is it a good practice to get all the data in Single call, when designing REST API for mobile App ?</title>
      <dc:creator>Nitesh Sawant</dc:creator>
      <pubDate>Sun, 14 Jun 2020 11:27:48 +0000</pubDate>
      <link>https://dev.to/ns23/is-it-a-good-practice-to-get-all-the-in-single-api-when-designing-rest-api-for-mobile-app-3jd5</link>
      <guid>https://dev.to/ns23/is-it-a-good-practice-to-get-all-the-in-single-api-when-designing-rest-api-for-mobile-app-3jd5</guid>
      <description>&lt;p&gt;Hi Everyone ,&lt;/p&gt;

&lt;p&gt;I have a question regarding designing the REST API for mobile application.&lt;/p&gt;

&lt;p&gt;Assuming I am designing a REST API for dashboard screen in mobile app.which fetches data from multiple tables in the database.&lt;/p&gt;

&lt;p&gt;In this case, what is the ideal approach?&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;One rest API to fetch all the data at once.&lt;/li&gt;
&lt;li&gt;Multiple rest API that fetches data from each database table.which may involve the second API to be called after the success of the first API.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Considering clean code practices like &lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Separation of code concerns
&lt;/li&gt;
&lt;li&gt;CPU usage/ and User experience  on the app&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Please share your experience on what should be the approach in such cases.&lt;/p&gt;

&lt;p&gt;Thank you&lt;/p&gt;

</description>
      <category>api</category>
      <category>android</category>
      <category>ios</category>
      <category>discuss</category>
    </item>
    <item>
      <title>How to test REST API where major bussiness logic is written in SQL</title>
      <dc:creator>Nitesh Sawant</dc:creator>
      <pubDate>Mon, 27 May 2019 15:26:38 +0000</pubDate>
      <link>https://dev.to/ns23/how-to-test-rest-api-where-major-bossiness-logic-is-written-in-sql-41ml</link>
      <guid>https://dev.to/ns23/how-to-test-rest-api-where-major-bossiness-logic-is-written-in-sql-41ml</guid>
      <description>&lt;p&gt;Hi all&lt;/p&gt;

&lt;p&gt;I am working on REST API written in express where business logic is written in raw SQL queries.&lt;/p&gt;

&lt;p&gt;I want to follow TDD for future development.But I am not able to find any resource to guide me on how to begin.&lt;/p&gt;

&lt;p&gt;Could anyone please lead me in the right direction on how to write test ?&lt;/p&gt;

</description>
      <category>help</category>
      <category>discuss</category>
      <category>javascript</category>
      <category>node</category>
    </item>
    <item>
      <title>Facebook messenger bot that displays latest IT jobs in Goa, India</title>
      <dc:creator>Nitesh Sawant</dc:creator>
      <pubDate>Mon, 03 Sep 2018 17:27:56 +0000</pubDate>
      <link>https://dev.to/ns23/facebook-messenger-bot-that-displays-latest-it-jobs-in-goa-india-68g</link>
      <guid>https://dev.to/ns23/facebook-messenger-bot-that-displays-latest-it-jobs-in-goa-india-68g</guid>
      <description>&lt;h2&gt;
  
  
  TL;DR
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://github.com/ns23/goa-startup-jobs-bot" rel="noopener noreferrer"&gt;View source code on github&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;This weekend as a side project I created a simple Facebook chatbot, that notifies latest jobs posted on &lt;a href="http://startupgoa.org/jobs/#.W4w1d3UzbMV" rel="noopener noreferrer"&gt;starupgoa.org&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Goa is a land of Sea, Sand and Startups and &lt;a href="http://startupgoa.org/jobs/#.W4w1d3UzbMV" rel="noopener noreferrer"&gt;starupgoa.org&lt;/a&gt; is one place where most of the IT jobs are posted.&lt;/p&gt;

&lt;p&gt;The jobs on &lt;a href="http://startupgoa.org/jobs/#.W4w1d3UzbMV" rel="noopener noreferrer"&gt;starupgoa.org&lt;/a&gt; are displayed like below.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fthepracticaldev.s3.amazonaws.com%2Fi%2Fvsu68lojda7stfkyw6ro.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fthepracticaldev.s3.amazonaws.com%2Fi%2Fvsu68lojda7stfkyw6ro.png" alt="startup go jobs"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;After looking in the network tab in chrome, I found the Ajax call that fetches jobs.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fthepracticaldev.s3.amazonaws.com%2Fi%2F65vw5qkmwtlinrsrmybw.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fthepracticaldev.s3.amazonaws.com%2Fi%2F65vw5qkmwtlinrsrmybw.png" alt="startup goa ajax"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;To get the experience in javascript,es6, and MongoDB, I chose to build this bot with Javascript.&lt;/p&gt;

&lt;p&gt;I found this awesome article on &lt;a href="https://hackernoon.com/" rel="noopener noreferrer"&gt;Hackernoon&lt;/a&gt; on&lt;br&gt;
&lt;a href="https://hackernoon.com/how-to-build-a-facebook-bot-app-using-node-js-74629d4243ec" rel="noopener noreferrer"&gt;How to Build a Facebook Bot App Using Node.js&lt;/a&gt;&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;The post will be very big if I start to explain the code line by. So I will quickly tell how the bot works.&lt;/p&gt;
&lt;/blockquote&gt;
&lt;h2&gt;
  
  
  How bot works in general
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;Initially, I have fetched the latest 100 jobs from the website and have stored it in the database [used mlab as database].&lt;/li&gt;
&lt;li&gt;When a Facebook user clicks on Get Started button, Bot captures that user's id and store it in the database. It is used to send the push notification.&lt;/li&gt;
&lt;li&gt;When user types &lt;code&gt;latest jobs&lt;/code&gt; in chat, bot fetches the latest five jobs from the database and displays it to the user.&lt;/li&gt;
&lt;li&gt;I Wrote a cron job using &lt;a href="https://www.npmjs.com/package/node-schedule" rel="noopener noreferrer"&gt;node-schedule&lt;/a&gt; that runs every day at 1 AM and fetches the latest jobs from the website and stores it in the database.&lt;/li&gt;
&lt;li&gt;If during cron job new jobs are fetched then bot send the push notification to the user with new Job.&lt;/li&gt;
&lt;/ol&gt;
&lt;h2&gt;
  
  
  Technology Stack
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Backend&lt;/strong&gt;  : Node JS&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Database&lt;/strong&gt; : MongoDB &lt;a href="https://mlab.com/" rel="noopener noreferrer"&gt;mlab&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Server&lt;/strong&gt;   : &lt;a href="https://www.heroku.com/" rel="noopener noreferrer"&gt;Heroku&lt;/a&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;h2&gt;
  
  
  Major Node Packages Used.
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;a href="https://www.npmjs.com/package/bootbot" rel="noopener noreferrer"&gt;Bootbot&lt;/a&gt; - JavaScript Framework to build Facebook Messenger's Chat bots.&lt;/li&gt;
&lt;li&gt;
&lt;a href="https://www.npmjs.com/package/cheerio" rel="noopener noreferrer"&gt;cheerio&lt;/a&gt; - Html Parser&lt;/li&gt;
&lt;li&gt;
&lt;a href="https://www.npmjs.com/package/winston" rel="noopener noreferrer"&gt;winston&lt;/a&gt; - Logger &lt;/li&gt;
&lt;li&gt;
&lt;a href="https://www.npmjs.com/package/node-schedule" rel="noopener noreferrer"&gt;node-schedule&lt;/a&gt; - To run cron job&lt;/li&gt;
&lt;li&gt;
&lt;a href="https://www.npmjs.com/package/request" rel="noopener noreferrer"&gt;request&lt;/a&gt; - Make API call&lt;/li&gt;
&lt;/ul&gt;
&lt;h2&gt;
  
  
  Demo
&lt;/h2&gt;

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

&lt;blockquote&gt;
&lt;p&gt;Currently the bot is in development mode and is not available for everyone.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h2&gt;
  
  
  Suggestions are welcome
&lt;/h2&gt;

&lt;p&gt;If you have suggestions to improve the bot please do comment.&lt;/p&gt;

&lt;h2&gt;
  
  
  Need Help
&lt;/h2&gt;

&lt;p&gt;I want to write unit tests for this bot, but I am not getting how to start with writing unit tests. If someone can help me with it,I will be really grateful.&lt;/p&gt;

&lt;h2&gt;
  
  
  Conclusion
&lt;/h2&gt;

&lt;p&gt;This is a simple bot and I hope It will be helpful to the IT job seekers in Goa.&lt;/p&gt;

</description>
      <category>showdev</category>
      <category>bot</category>
      <category>javascript</category>
      <category>beginners</category>
    </item>
    <item>
      <title>Is NPM registry not working ?</title>
      <dc:creator>Nitesh Sawant</dc:creator>
      <pubDate>Sat, 01 Sep 2018 13:11:52 +0000</pubDate>
      <link>https://dev.to/ns23/is-npm-registry-not-working--41hc</link>
      <guid>https://dev.to/ns23/is-npm-registry-not-working--41hc</guid>
      <description>&lt;p&gt;Hello Everyone.&lt;/p&gt;

&lt;p&gt;Today while I was workig on a Node JS project suddenly I was not able to install any packages using &lt;code&gt;npm&lt;/code&gt; command.&lt;/p&gt;

&lt;p&gt;I am getting below error whenever I am trying to install any package&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fthepracticaldev.s3.amazonaws.com%2Fi%2Fy960c5vu6oeyksudfu0t.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fthepracticaldev.s3.amazonaws.com%2Fi%2Fy960c5vu6oeyksudfu0t.png" alt="npm install error"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;So when I visited NPM regitry website I got following message.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fthepracticaldev.s3.amazonaws.com%2Fi%2Ftk32ygr6npvjw9k84q7b.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fthepracticaldev.s3.amazonaws.com%2Fi%2Ftk32ygr6npvjw9k84q7b.png" alt="npm registry website"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Is anyone else getting the same error when trying to install a node package ?.&lt;/p&gt;

</description>
      <category>discuss</category>
      <category>javascript</category>
      <category>help</category>
      <category>node</category>
    </item>
    <item>
      <title>A python script that shows the distribution of IT companies in Goa India.</title>
      <dc:creator>Nitesh Sawant</dc:creator>
      <pubDate>Sun, 29 Apr 2018 16:11:09 +0000</pubDate>
      <link>https://dev.to/ns23/a-python-script-that-shows-the-distribution-of-it-companies-in-goa-india-2jjj</link>
      <guid>https://dev.to/ns23/a-python-script-that-shows-the-distribution-of-it-companies-in-goa-india-2jjj</guid>
      <description>&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fthepracticaldev.s3.amazonaws.com%2Fi%2Fgpumppfwyv8fuwp05btv.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fthepracticaldev.s3.amazonaws.com%2Fi%2Fgpumppfwyv8fuwp05btv.png" alt="IT companies in Goa"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Recently I was learning web scraping using &lt;em&gt;BeautifulSoup&lt;/em&gt; library in python.After learning the basics concepts of web scraping, I wanted to use to use it to write some real-world program.&lt;/p&gt;

&lt;p&gt;While browsing the internet I came across website &lt;a href="http://startupgoa.org/companies/#.WtIhBXVubZs" rel="noopener noreferrer"&gt;startupgoa.org&lt;/a&gt; which have a list of startups in Goa, India [FYI I am from GOA].&lt;/p&gt;

&lt;p&gt;So I decided to write a python script that will &lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Scrap this list of companies in Goa.&lt;/li&gt;
&lt;li&gt;Get location (latitude &amp;amp; Longitude) of these using Geocoder(I used Google geocoder API).&lt;/li&gt;
&lt;li&gt;Plot those points on the map using a python package &lt;em&gt;Folium&lt;/em&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;After lots of googling &amp;amp; searching for answers on StackOverflow below is the end result.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://ns23.github.io/startupGoaMap/" rel="noopener noreferrer"&gt;Demo :https://ns23.github.io/startupGoaMap/&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://github.com/ns23/startupGoaMap" rel="noopener noreferrer"&gt;Github Repo&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Please do provide feedback &amp;amp; let me know in comments if I can improve this script.&lt;/p&gt;

</description>
      <category>showdev</category>
      <category>firstpost</category>
      <category>python</category>
    </item>
  </channel>
</rss>
