<?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: Carlos Guzmán</title>
    <description>The latest articles on DEV Community by Carlos Guzmán (@calguzman).</description>
    <link>https://dev.to/calguzman</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%2F522341%2F02b3b464-dac2-4c38-9b8b-45406e8c633a.jpeg</url>
      <title>DEV Community: Carlos Guzmán</title>
      <link>https://dev.to/calguzman</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/calguzman"/>
    <language>en</language>
    <item>
      <title>How to start developing mobile applications. </title>
      <dc:creator>Carlos Guzmán</dc:creator>
      <pubDate>Fri, 14 May 2021 16:41:58 +0000</pubDate>
      <link>https://dev.to/calguzman/how-to-start-developing-mobile-applications-342i</link>
      <guid>https://dev.to/calguzman/how-to-start-developing-mobile-applications-342i</guid>
      <description>&lt;h1&gt;
  
  
  How to start developing mobile applications.
&lt;/h1&gt;

&lt;p&gt;First, I want to confess that I am a beginner in developing mobile applications,  but today, I would like to share with you, my little experience and some points that you should keep in mind to start with a simple project. &lt;/p&gt;

&lt;p&gt;To start, you should know, that you can develop mobile applications of multiple forms, you can use frameworks to build once and deploy to both platforms (Android and ios); this is great because your team can save time to deploy the application and can use a specific language to write the code.  &lt;/p&gt;

&lt;p&gt;Another way to develop mobile applications consists in use native frameworks or SDK provided for Google and Apple; the main difference is that you must learn the native language to each platform. For Example: if you want to develop an app for ios you need to learn Swift; the same happens for Android.  &lt;/p&gt;

&lt;p&gt;With the last mentioned way, you can use all native APIs to each platform, take advantage of native APIs to improve the performance of your applications, and use specific features that usually not available when you use and intermediaries to build mobile applications. &lt;/p&gt;

&lt;p&gt;Some libraries or frameworks that can you help to develop mobile applications writing code once and next you can deploy for both platforms are: &lt;/p&gt;

&lt;p&gt;Xamarin: This platform was developed with Microsoft, at this moment, uses C# language to write code. Remember that the purpose of these platforms is to permit that you write one time to deploy in both platforms. &lt;/p&gt;

&lt;p&gt;Ionic: Ionic is an open-source mobile UI toolkit for building high-quality, cross-platform native and web app experiences. You can move faster with a single code base, running everywhere with JavaScript and the Web&lt;/p&gt;

&lt;p&gt;React Native:  The premise of react native is "Learn once, write anywhere", React Native combines the best parts of native development with React, a best-in-class JavaScript library for building user interfaces. You can use React Native today in your existing Android and iOS projects or you can create a whole new app from scratch.&lt;/p&gt;

&lt;p&gt;Now that you know some ways to create a mobile app, I want to remember you that you must know the limitations of each library or framework based on your necessity, for example: if you need to use Bluetooth, camera, GPS, and any other feature, you must sure that your library supports these features, at the same time, you must know which tools provide the framework or library that can help to develop, debug and deploy your app. &lt;/p&gt;

&lt;p&gt;At this point, maybe,  you are interested in the performance of your app, some frameworks promise fast apps with features like 60 Frames per second, Down to: 1.8 Sec Time to interact, etc. again you must analyze what is the purpose and objective of your application and if this requires the best performance or is acceptable for your app. &lt;/p&gt;

&lt;p&gt;Now, I want to show, how to create a simple project, using react native, remember that react native, use react library to control the render cycle of the app. &lt;/p&gt;

&lt;p&gt;First, you should must sure to have installed node js and npm, if not have installed follow the next instructions. &lt;/p&gt;

&lt;p&gt;&lt;a href="https://www.npmjs.com/get-npm"&gt;https://www.npmjs.com/get-npm&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;if you are new to mobile development, the easiest way to get started is with Explo CLI.   Expo is a set of tools built around React Native and, while it has many features, the most relevant feature for us right now is that it can get you writing a React Native app within minutes.&lt;/p&gt;

&lt;p&gt;First, let's install expo-CLI.&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="nx"&gt;npm&lt;/span&gt; &lt;span class="nx"&gt;install&lt;/span&gt; &lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="nx"&gt;g&lt;/span&gt; &lt;span class="nx"&gt;expo&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="nx"&gt;CLI&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Now, let's create a new project using expo CLI.&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="nx"&gt;expo&lt;/span&gt; &lt;span class="nx"&gt;init&lt;/span&gt; &lt;span class="nx"&gt;name&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="k"&gt;for&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="nx"&gt;your&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="nx"&gt;app&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The last command creates and prepares a folder with the libraries, and scaffolding to start a project. &lt;/p&gt;

&lt;p&gt;Next, you should enter the folder with the name app. &lt;/p&gt;

&lt;p&gt;example:&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="nx"&gt;cd&lt;/span&gt; &lt;span class="nx"&gt;name&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="k"&gt;for&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="nx"&gt;your&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="nx"&gt;app&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;and run the project with the start command.&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="nx"&gt;npm&lt;/span&gt; &lt;span class="nx"&gt;start&lt;/span&gt; &lt;span class="c1"&gt;// Or use expo start&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;After running expo start or npm start you can see a menu with the options to run ios or android simulator, once you can run the simulator, you should see the app. &lt;/p&gt;

&lt;p&gt;Congratulations, you have now your first mobile application. &lt;/p&gt;

&lt;p&gt;thanks for your attention. &lt;/p&gt;

</description>
    </item>
    <item>
      <title>How to use basic styled-components in React</title>
      <dc:creator>Carlos Guzmán</dc:creator>
      <pubDate>Sun, 24 Jan 2021 23:50:42 +0000</pubDate>
      <link>https://dev.to/calguzman/how-to-use-basic-styled-components-in-react-21bk</link>
      <guid>https://dev.to/calguzman/how-to-use-basic-styled-components-in-react-21bk</guid>
      <description>&lt;p&gt;Styled Components, is a library used in react for write CSS into Javascript files, this is good usually when you want to have your CSS code into the component or create a specific component with style and personalized tag. &lt;/p&gt;

&lt;p&gt;To install the library, into your react project run:&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="nx"&gt;npm&lt;/span&gt; &lt;span class="nx"&gt;install&lt;/span&gt; &lt;span class="o"&gt;--&lt;/span&gt;&lt;span class="nx"&gt;save&lt;/span&gt; &lt;span class="nx"&gt;styled&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="nx"&gt;components&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt; 
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Styled-components utilize tagged template literals to style your components. It removes the mapping between components and styles. This means that when you are defining your styles, you are actually creating a normal React component, that has your styles attached to it. &lt;/p&gt;

&lt;p&gt;After installing the library, you can use these functions in your component. &lt;/p&gt;

&lt;p&gt;Remember to import the library into JS File.&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;import&lt;/span&gt; &lt;span class="nx"&gt;styled&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;styled-components&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Example:&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="s2"&gt;`// Create a Title component that'll render an &amp;lt;h1&amp;gt; tag with some styles
const Title = styled.h1`&lt;/span&gt;
  &lt;span class="nx"&gt;font&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="nx"&gt;size&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mf"&gt;1.5&lt;/span&gt;&lt;span class="nx"&gt;em&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="nx"&gt;text&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="nx"&gt;align&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;center&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="nl"&gt;color&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;palevioletred&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="s2"&gt;`;

// Create a Wrapper component that'll render a &amp;lt;section&amp;gt; tag with some styles
const Wrapper = styled.section`&lt;/span&gt;
  &lt;span class="nx"&gt;padding&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;4&lt;/span&gt;&lt;span class="nx"&gt;em&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="nl"&gt;background&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;papayawhip&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="s2"&gt;`;

// Use Title and Wrapper like any other React component – except they're styled!
render(
  &amp;lt;Wrapper&amp;gt;
    &amp;lt;Title&amp;gt;
      Hello World!
    &amp;lt;/Title&amp;gt;
  &amp;lt;/Wrapper&amp;gt;
);`&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;If you want more information, you can see styled-components documentation in the next link. &lt;/p&gt;

&lt;p&gt;&lt;a href="https://styled-components.com/docs/basics#installation"&gt;https://styled-components.com/docs/basics#installation&lt;/a&gt;&lt;/p&gt;

</description>
    </item>
    <item>
      <title>How to Install SynthWave '84 Theme in VScode and Enable Neon Dreams in OSX</title>
      <dc:creator>Carlos Guzmán</dc:creator>
      <pubDate>Mon, 21 Dec 2020 01:05:46 +0000</pubDate>
      <link>https://dev.to/calguzman/how-to-install-synthwave-84-theme-in-vscode-and-enable-neon-dreams-in-osx-614</link>
      <guid>https://dev.to/calguzman/how-to-install-synthwave-84-theme-in-vscode-and-enable-neon-dreams-in-osx-614</guid>
      <description>&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--y_uLvv6R--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/w7qfrignv5dbnjz15y0h.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--y_uLvv6R--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/w7qfrignv5dbnjz15y0h.png" alt="SynthWave '84 "&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;First, Open the next link in your favorite browser: &lt;/p&gt;

&lt;p&gt;&lt;a href="https://marketplace.visualstudio.com/items?itemName=RobbOwen.synthwave-vscode"&gt;https://marketplace.visualstudio.com/items?itemName=RobbOwen.synthwave-vscode&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Click on the install button. &lt;/p&gt;

&lt;p&gt;For Select, your theme, go to the menu on the top bar: Code -&amp;gt; Preferences -&amp;gt; Color Theme and click there. In the list, select SynthWave '84. &lt;/p&gt;

&lt;p&gt;Now, in the visual studio code window, press the next shortcode: Shift + CMD + P and write Enable Neon Dreams, and select in the list: SynthWave '84: Enable Neon Dreams.&lt;/p&gt;

&lt;p&gt;Excellent, now your favorite code editor uses SynthWave '84 with the feature Neon Dreams Enable. &lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--59cRd7eQ--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://github.com/robb0wen/synthwave-vscode/raw/master/theme.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--59cRd7eQ--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://github.com/robb0wen/synthwave-vscode/raw/master/theme.jpg" alt="Neon Dreams"&gt;&lt;/a&gt;&lt;/p&gt;

</description>
    </item>
    <item>
      <title>How to create a basic structure for a Next JS App, manually or using a boilerplate tool. </title>
      <dc:creator>Carlos Guzmán</dc:creator>
      <pubDate>Sun, 06 Dec 2020 02:36:24 +0000</pubDate>
      <link>https://dev.to/calguzman/how-to-create-a-basic-structure-for-a-next-js-app-manually-or-using-a-boilerplate-tool-3h9g</link>
      <guid>https://dev.to/calguzman/how-to-create-a-basic-structure-for-a-next-js-app-manually-or-using-a-boilerplate-tool-3h9g</guid>
      <description>&lt;p&gt;Next.js is a wonderful production framework for React. This framework has two ways to create a Next Js App.  The first way is using a boilerplate from Next Js APP, to use this tool, perform the following steps.&lt;/p&gt;

&lt;p&gt;Before, you should have installed, one tool for package management such as npm or yarn.&lt;/p&gt;

&lt;h1&gt;
  
  
  Create next-app Tool.
&lt;/h1&gt;

&lt;p&gt;1.Yarn&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="nx"&gt;yarn&lt;/span&gt; &lt;span class="nx"&gt;create&lt;/span&gt; &lt;span class="nx"&gt;next&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="nx"&gt;app&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;OR &lt;br&gt;
1.Npm&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="nx"&gt;npm&lt;/span&gt; &lt;span class="nx"&gt;create&lt;/span&gt; &lt;span class="nx"&gt;next&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="nx"&gt;app&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ol&gt;
&lt;li&gt;&lt;p&gt;NPM OR YARN.&lt;br&gt;
The assistant should ask your app name, in this case, write a name for your app and press the KEY ENTER. &lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Now your app structure was created, enter to App directory.  &lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;cd my-app&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Enjoy! Now you can run the application, create a build, and finally run the application in production mode. &lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;// Run Dev Server&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="nx"&gt;yarn&lt;/span&gt; &lt;span class="nx"&gt;dev&lt;/span&gt; 
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;





&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="nx"&gt;yarn&lt;/span&gt; &lt;span class="nx"&gt;build&lt;/span&gt; &lt;span class="c1"&gt;// Create a build&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;





&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="nx"&gt;yarn&lt;/span&gt; &lt;span class="nx"&gt;start&lt;/span&gt; &lt;span class="c1"&gt;// run server in production mode after a build&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;You can use the same commands with npm, only replace the word "yarn" for "npm"&lt;/p&gt;

&lt;h1&gt;
  
  
  Manually.
&lt;/h1&gt;

&lt;p&gt;To create the structure app manually perform the next steps: &lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Make a directory with the name of your application. 
In the console write:
&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="nx"&gt;mkdir&lt;/span&gt; &lt;span class="nx"&gt;next&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="nx"&gt;js&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="nx"&gt;app&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ol&gt;
&lt;li&gt;&lt;p&gt;Enter to Directory. In the console write: cd next-js-app&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;NPM: npm install next react react-dom OR Yarn write: &lt;br&gt;
yarn add next  react react-dom&lt;br&gt;
&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="nx"&gt;npm&lt;/span&gt; &lt;span class="nx"&gt;install&lt;/span&gt; &lt;span class="nx"&gt;next&lt;/span&gt; &lt;span class="nx"&gt;react&lt;/span&gt; &lt;span class="nx"&gt;react&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="nx"&gt;dom&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;OR&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="nx"&gt;yarn&lt;/span&gt; &lt;span class="nx"&gt;add&lt;/span&gt; &lt;span class="nx"&gt;next&lt;/span&gt;  &lt;span class="nx"&gt;react&lt;/span&gt; &lt;span class="nx"&gt;react&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="nx"&gt;dom&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ol&gt;
&lt;li&gt;Edit the file Package.Json, and add in the scripts section, the next lines.
&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;scripts&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="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;dev&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;next&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;build&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;next build&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;start&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;next start&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;
&lt;span class="p"&gt;},&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ol&gt;
&lt;li&gt;Now, you need a page directory: In the root directory, create a directory named pages. 
Example: mkdir pages
&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="nx"&gt;mkdir&lt;/span&gt; &lt;span class="nx"&gt;pages&lt;/span&gt; 
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Enjoy, now you can run the app. for example in dev mode.&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="nx"&gt;npm&lt;/span&gt; &lt;span class="nx"&gt;run&lt;/span&gt; &lt;span class="nx"&gt;dev&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt; 

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

&lt;/div&gt;



</description>
    </item>
    <item>
      <title>How to hash a password before save into DB with JavaScript and bcrypt.</title>
      <dc:creator>Carlos Guzmán</dc:creator>
      <pubDate>Sat, 28 Nov 2020 16:30:11 +0000</pubDate>
      <link>https://dev.to/calguzman/how-to-encrypt-a-password-before-save-into-db-with-javascript-and-bcrypt-1p7b</link>
      <guid>https://dev.to/calguzman/how-to-encrypt-a-password-before-save-into-db-with-javascript-and-bcrypt-1p7b</guid>
      <description>&lt;p&gt;When you save data from users, such as username, email, phone numbers, and other data, is usually save these data in plain text, however, for user passwords, it is not secure, because, if your DB is compromised, all passwords its exposes.&lt;/p&gt;

&lt;p&gt;So, hash all password before save into DB,  usually is a good practice. bcrypt, is a JavaScript Library for this propose. &lt;/p&gt;

&lt;p&gt;Remember init your npm project with npm init and install the library with npm install bcrypt. &lt;/p&gt;

&lt;p&gt;Now implement your library.&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;bcrypt&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="s1"&gt;bcrypt&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt; &lt;span class="c1"&gt;// import the Library. &lt;/span&gt;
&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;saltRounds&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;10&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="c1"&gt;// The number of rounds for encrypt the passwords. &lt;/span&gt;
&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;myPlaintextPassword&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;examplePassword&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="c1"&gt;// Now, use bcrypt for encrypt the plain Password. &lt;/span&gt;

&lt;span class="nx"&gt;bcrypt&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;hash&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;myPlaintextPassword&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;saltRounds&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="kd"&gt;function&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;err&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;hash&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="c1"&gt;// Store hash in your password DB.&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="nx"&gt;hash&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 you need compare un plain Password with your saved password, you can use the function compare.&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="nx"&gt;bcrypt&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;compare&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;myPlaintextPassword&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;hash&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="kd"&gt;function&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;err&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;result&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="c1"&gt;// result == true&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;result&lt;/span&gt;&lt;span class="o"&gt;==&lt;/span&gt;&lt;span class="kc"&gt;true&lt;/span&gt;&lt;span class="p"&gt;){&lt;/span&gt;
 &lt;span class="c1"&gt;// The Password is Correct!&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="k"&gt;else&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
 &lt;span class="c1"&gt;// Your password is not correct. &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;It's All, &lt;/p&gt;

&lt;p&gt;Thanks!&lt;/p&gt;

</description>
    </item>
  </channel>
</rss>
