<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Moses Esan on Medium]]></title>
        <description><![CDATA[Stories by Moses Esan on Medium]]></description>
        <link>https://medium.com/@mosesesan?source=rss-35e62dce4e81------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*GfgmOsjGcdx3bDYf_h7YUw.png</url>
            <title>Stories by Moses Esan on Medium</title>
            <link>https://medium.com/@mosesesan?source=rss-35e62dce4e81------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sun, 15 Nov 2026 19:35:05 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@mosesesan/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Node.js API: Add CRUD Operations With Pagination, Filtering, Grouping, and Sorting Capabilities.]]></title>
            <description><![CDATA[<div class="medium-feed-item"><p class="medium-feed-image"><a href="https://medium.com/swlh/node-js-api-add-crud-operations-with-pagination-filtering-grouping-and-sorting-capabilities-55375ad0b774?source=rss-35e62dce4e81------2"><img src="https://cdn-images-1.medium.com/max/600/1*xiGWbjm7h9TVgVlE6UTNkQ.gif" width="600"></a></p><p class="medium-feed-snippet">Add CRUD and Aggregation operations including Pagination, Sorting, Filtering and Partial Text Search to your Node.js REST API.</p><p class="medium-feed-link"><a href="https://medium.com/swlh/node-js-api-add-crud-operations-with-pagination-filtering-grouping-and-sorting-capabilities-55375ad0b774?source=rss-35e62dce4e81------2">Continue reading on The Startup »</a></p></div>]]></description>
            <link>https://medium.com/swlh/node-js-api-add-crud-operations-with-pagination-filtering-grouping-and-sorting-capabilities-55375ad0b774?source=rss-35e62dce4e81------2</link>
            <guid isPermaLink="false">https://medium.com/p/55375ad0b774</guid>
            <category><![CDATA[programming]]></category>
            <category><![CDATA[nodejs]]></category>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[software-development]]></category>
            <category><![CDATA[software-engineering]]></category>
            <dc:creator><![CDATA[Moses Esan]]></dc:creator>
            <pubDate>Tue, 14 Jan 2020 07:01:01 GMT</pubDate>
            <atom:updated>2020-04-12T20:58:17.533Z</atom:updated>
        </item>
        <item>
            <title><![CDATA[How To Add Authentication to Your React Native App]]></title>
            <description><![CDATA[<div class="medium-feed-item"><p class="medium-feed-image"><a href="https://medium.com/better-programming/how-to-add-authentication-to-your-react-native-app-with-react-hooks-and-react-context-api-46f57aedbbd?source=rss-35e62dce4e81------2"><img src="https://cdn-images-1.medium.com/max/600/1*etSpPY4I5PPZz3uNX1g1Uw.gif" width="600"></a></p><p class="medium-feed-snippet">Authenticate your users the modern way: with React Hooks and the React Context API</p><p class="medium-feed-link"><a href="https://medium.com/better-programming/how-to-add-authentication-to-your-react-native-app-with-react-hooks-and-react-context-api-46f57aedbbd?source=rss-35e62dce4e81------2">Continue reading on Better Programming »</a></p></div>]]></description>
            <link>https://medium.com/better-programming/how-to-add-authentication-to-your-react-native-app-with-react-hooks-and-react-context-api-46f57aedbbd?source=rss-35e62dce4e81------2</link>
            <guid isPermaLink="false">https://medium.com/p/46f57aedbbd</guid>
            <category><![CDATA[software-engineering]]></category>
            <category><![CDATA[programming]]></category>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[react-native]]></category>
            <category><![CDATA[react]]></category>
            <dc:creator><![CDATA[Moses Esan]]></dc:creator>
            <pubDate>Tue, 07 Jan 2020 20:56:30 GMT</pubDate>
            <atom:updated>2020-04-03T21:18:17.299Z</atom:updated>
        </item>
        <item>
            <title><![CDATA[How to Build a Node.js Authentication API with Email Verification, Image Upload and Password Reset.]]></title>
            <description><![CDATA[<div class="medium-feed-item"><p class="medium-feed-image"><a href="https://medium.com/swlh/how-to-build-a-node-js-authentication-api-with-email-verification-image-upload-and-password-reset-95e35fd46be1?source=rss-35e62dce4e81------2"><img src="https://cdn-images-1.medium.com/max/600/1*d1L2lzHvp4BtsD25hFCI7g.gif" width="600"></a></p><p class="medium-feed-snippet">Build a Node.js Authentication API with Email Verification, Image Upload and Password Reset using JWT, Passport.js and Sendgrid.</p><p class="medium-feed-link"><a href="https://medium.com/swlh/how-to-build-a-node-js-authentication-api-with-email-verification-image-upload-and-password-reset-95e35fd46be1?source=rss-35e62dce4e81------2">Continue reading on The Startup »</a></p></div>]]></description>
            <link>https://medium.com/swlh/how-to-build-a-node-js-authentication-api-with-email-verification-image-upload-and-password-reset-95e35fd46be1?source=rss-35e62dce4e81------2</link>
            <guid isPermaLink="false">https://medium.com/p/95e35fd46be1</guid>
            <category><![CDATA[software-engineering]]></category>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[nodejs]]></category>
            <category><![CDATA[software-development]]></category>
            <category><![CDATA[programming]]></category>
            <dc:creator><![CDATA[Moses Esan]]></dc:creator>
            <pubDate>Wed, 20 Nov 2019 20:16:12 GMT</pubDate>
            <atom:updated>2020-03-10T15:39:23.567Z</atom:updated>
        </item>
        <item>
            <title><![CDATA[How to Build a News App with Search and Load More Functionality Using React Native and Redux.]]></title>
            <description><![CDATA[<div class="medium-feed-item"><p class="medium-feed-image"><a href="https://medium.com/swlh/how-to-build-a-news-app-with-search-and-load-more-functionality-using-react-native-and-redux-2875e827cd7f?source=rss-35e62dce4e81------2"><img src="https://cdn-images-1.medium.com/max/600/1*pBDAWxIClDdtPTDTo3gJ_w.gif" width="600"></a></p><p class="medium-feed-snippet">Build a News App with Search and Load More functionality using React Native and Redux in 12 steps.</p><p class="medium-feed-link"><a href="https://medium.com/swlh/how-to-build-a-news-app-with-search-and-load-more-functionality-using-react-native-and-redux-2875e827cd7f?source=rss-35e62dce4e81------2">Continue reading on The Startup »</a></p></div>]]></description>
            <link>https://medium.com/swlh/how-to-build-a-news-app-with-search-and-load-more-functionality-using-react-native-and-redux-2875e827cd7f?source=rss-35e62dce4e81------2</link>
            <guid isPermaLink="false">https://medium.com/p/2875e827cd7f</guid>
            <category><![CDATA[software-engineering]]></category>
            <category><![CDATA[programming]]></category>
            <category><![CDATA[mobile-development]]></category>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[software-development]]></category>
            <dc:creator><![CDATA[Moses Esan]]></dc:creator>
            <pubDate>Wed, 20 Nov 2019 09:01:01 GMT</pubDate>
            <atom:updated>2019-12-10T21:02:36.676Z</atom:updated>
        </item>
        <item>
            <title><![CDATA[How to Add Password Reset to Your Node.js Authentication API using SendGrid]]></title>
            <description><![CDATA[<div class="medium-feed-item"><p class="medium-feed-image"><a href="https://medium.com/mesan-digital/tutorial-3b-how-to-add-password-reset-to-your-node-js-authentication-api-using-sendgrid-ada54c8c0d1f?source=rss-35e62dce4e81------2"><img src="https://cdn-images-1.medium.com/max/600/1*ov1T9v7PZtGzo4tp8FY07g.gif" width="600"></a></p><p class="medium-feed-snippet">Add Password Reset to your Node.js Authentication API using Sendgrid.</p><p class="medium-feed-link"><a href="https://medium.com/mesan-digital/tutorial-3b-how-to-add-password-reset-to-your-node-js-authentication-api-using-sendgrid-ada54c8c0d1f?source=rss-35e62dce4e81------2">Continue reading on Mesan Digital »</a></p></div>]]></description>
            <link>https://medium.com/mesan-digital/tutorial-3b-how-to-add-password-reset-to-your-node-js-authentication-api-using-sendgrid-ada54c8c0d1f?source=rss-35e62dce4e81------2</link>
            <guid isPermaLink="false">https://medium.com/p/ada54c8c0d1f</guid>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[api]]></category>
            <category><![CDATA[nodejs]]></category>
            <category><![CDATA[password-reset]]></category>
            <category><![CDATA[sendgrid]]></category>
            <dc:creator><![CDATA[Moses Esan]]></dc:creator>
            <pubDate>Fri, 01 Nov 2019 12:00:44 GMT</pubDate>
            <atom:updated>2019-11-03T10:23:43.210Z</atom:updated>
        </item>
        <item>
            <title><![CDATA[How to Build a Node.js Authentication API using JWT, MongoDB, Express.js and Passport.js]]></title>
            <link>https://medium.com/mesan-digital/tutorial-3a-how-to-build-a-node-js-a998838de6a2?source=rss-35e62dce4e81------2</link>
            <guid isPermaLink="false">https://medium.com/p/a998838de6a2</guid>
            <category><![CDATA[nodejs]]></category>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[passportjs]]></category>
            <category><![CDATA[jwt]]></category>
            <category><![CDATA[api]]></category>
            <dc:creator><![CDATA[Moses Esan]]></dc:creator>
            <pubDate>Mon, 28 Oct 2019 20:03:14 GMT</pubDate>
            <atom:updated>2020-04-12T21:05:18.021Z</atom:updated>
            <content:encoded><![CDATA[<p>Build a Node.js Authentication API using JWT and Passport.js in 10 steps.</p><p><em>Please note that this tutorial assumes you have some Javascript experience, this tutorial does not explain each line of the code instead it presents you with the code and gives you an overview of what the code does and points out the important parts of the code. I have made the code as simple as possible, if you have any questions, please do not hesitate to leave a comment.</em></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/800/1*wcX5NyzIcEaAmlgor5WObA.gif" /><figcaption>Demo 1</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/600/1*D_VJXgtFsjoDTyShtwVA0g.gif" /><figcaption>Demo 2</figcaption></figure><h4>What is JSON Web Tokens (JWT)?</h4><p>JSON Web Tokens are an open, industry standard <a href="https://tools.ietf.org/html/rfc7519"><strong>RFC 7519</strong></a> method for representing claims securely between two parties. <a href="https://jwt.io/">JWT.IO</a> allows you to decode, verify and generate JWT.</p><p>JWT is a type of token-based authentication. The client sends the token along with every request from to the server, the server validates it and sends back the response.</p><h4>What is Passport.js?</h4><p><a href="http://www.passportjs.org/">Passport</a> is authentication middleware for <a href="https://nodejs.org/">Node.js</a>. As it’s extremely flexible and modular, Passport can be unobtrusively dropped into any <a href="https://expressjs.com/">Express</a>-based web application. A comprehensive set of strategies supports authentication using a <a href="http://www.passportjs.org/docs/username-password/">username and password</a>, <a href="http://www.passportjs.org/docs/facebook/">Facebook</a>, <a href="http://www.passportjs.org/docs/twitter/">Twitter</a>, and <a href="http://www.passportjs.org/packages/">more</a>.</p><h4>Requirements</h4><ol><li><a href="https://nodejs.org/en/">Node.js</a></li><li><a href="https://mlab.com/">mLab</a> free account for database, create a MongoDB database, take note of the database URL.</li><li><a href="https://cloudinary.com/users/register/free">Cloudinary</a> free account for image upload.</li></ol><h4>Functionalities</h4><ol><li>register</li><li>login</li><li>update profile</li><li><strong>upload a profile image</strong></li><li><strong>password reset</strong></li></ol><h4>Step 1: Create new project</h4><pre><strong>Create a new directory</strong></pre><pre>$ mkdir nodejsapi<br>$ cd nodejsapi</pre><pre><strong>Create the package.json</strong><br>$ npm init -f</pre><h4>Step 2: Install Dependencies</h4><p>The following packages will be used:</p><ul><li>e<a href="https://expressjs.com/">xpress</a>, a minimal and flexible Node.js web application framework</li><li>b<a href="https://github.com/kelektiv/node.bcrypt.js">crypt</a>, A library to help you hash passwords.</li><li><a href="https://github.com/auth0/node-jsonwebtoken">jsonwebtoken</a>, An implementation of <a href="https://tools.ietf.org/html/rfc7519">JSON Web Tokens</a>.</li><li><a href="https://mongoosejs.com/">mongoose</a>, Mongoose provides a straight-forward, schema-based solution to model your application data.</li><li><a href="http://www.passportjs.org/">passport</a>, an authentication middleware for <a href="https://nodejs.org/">Node.js</a>. Extremely flexible and modular, Passport can be unobtrusively dropped in to any <a href="https://expressjs.com/">Express</a>-based web application.</li><li><a href="http://www.passportjs.org/packages/passport-jwt/">passport-jwt</a>, A <strong>Passport</strong> strategy for authenticating with a JSON Web Token.</li><li><a href="https://github.com/expressjs/cors">cors</a>, CORS is a node.js package for providing a <a href="http://www.senchalabs.org/connect/">Connect</a>/<a href="http://expressjs.com/">Express</a> middleware that can be used to enable <a href="http://en.wikipedia.org/wiki/Cross-origin_resource_sharing">CORS</a> with various options.</li><li><a href="https://github.com/motdotla/dotenv">dotenv</a>, Dotenv is a zero-dependency module that loads environment variables from a .env file into <a href="https://nodejs.org/docs/latest/api/process.html#process_process_env">process.env</a>.</li><li><a href="https://express-validator.github.io/docs/">express-validator</a>, express-validator is a set of <a href="http://expressjs.com/">express.js</a> middlewares that wraps <a href="https://github.com/chriso/validator.js">validator.js</a> validator and sanitizer functions.</li></ul><pre>$ npm install bcrypt express jsonwebtoken mongoose passport passport-jwt cors dotenv express-validator --save</pre><p><strong>Image Upload Dependencies</strong></p><ul><li><a href="https://github.com/expressjs/multer">multer</a>: Node.js middleware for handling `multipart/form-data`.</li><li><a href="https://github.com/data-uri/datauri">datauri</a>, Node.js <a href="https://www.npmjs.com/package/datauri#module">Module</a> and <a href="http://npm.im/datauri-cli">CLI</a> to generate <a href="http://en.wikipedia.org/wiki/Data_URI_scheme">Data URI scheme</a>.</li><li><a href="https://github.com/cloudinary/cloudinary_npm">cloudinary</a></li></ul><pre>$ npm install multer datauri cloudinary --save</pre><p><strong>Development Dependencies</strong></p><ul><li><a href="https://www.npmjs.com/package/nodemon">nodemon</a>: nodemon is a tool that helps develop node.js based applications by automatically restarting the node application when file changes in the directory are detected.</li></ul><pre>$ npm install nodemon --save-dev</pre><pre>----</pre><pre># add the following to <strong>package</strong>.json scripts section<br><strong>&quot;scripts&quot;</strong>: {<br>    <strong>&quot;start&quot;</strong>: <strong>&quot;nodemon src/server.js&quot;<br></strong>},</pre><h4>Step 3: Create environment variables</h4><p>In your project root, create a .env file.</p><pre>$ touch .env</pre><p>In this file, we define the <em>JWT secret</em> used for creating and verifying the authentication tokens. The mongo <em>database url, the cloudinary app name, api and secret key</em>.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/0a5c799b9d8604826f9a203237397adb/href">https://medium.com/media/0a5c799b9d8604826f9a203237397adb/href</a></iframe><h4>Step 4: Create Folder Structure</h4><p>In your project root create a <strong>src</strong> folder.</p><pre><strong>Main Folder</strong><br>$ mkdir src<br>$ cd src</pre><pre><strong>Subfolders and server.js file</strong><br>$ mkdir config routes models controllers middlewares<br>$ touch server.js</pre><h4>Step 5: Configuration</h4><p>In the config folder, create a new javascript file cloudinary.js<strong><em>, </em></strong>in here we will create a cloudinary instance and configure it using the API Key and API Secret and Cloud Name</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/5c0b7bef6e6bd20f4374a5e947fee7f5/href">https://medium.com/media/5c0b7bef6e6bd20f4374a5e947fee7f5/href</a></iframe><h4>Step 6: Middleware</h4><p>In the middlewares folder, create the following files.</p><pre><strong>jwt.js</strong></pre><pre>The Passport JWT authentication strategy is created and configured.<br>is created.</pre><pre>&quot;<strong>fromAuthHeaderAsBearerToken()</strong> creates a new extractor that looks for the JWT in the authorization header with the scheme &#39;bearer&#39;&quot;</pre><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/5007b515867d25aed39e88a678b38cc0/href">https://medium.com/media/5007b515867d25aed39e88a678b38cc0/href</a></iframe><pre><strong>authenticate.js</strong></pre><pre>This middleware is used to authenticate the users request. Using passport.authenticate() and specifying the &#39;jwt&#39; strategy, the request is authenticated by checking for the standard <em>Authorization</em> header and verifying the verification token, if any.</pre><pre>If unable to authenticate request, an error message is returned.</pre><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/08e1fc75391ce9b48ea75f2bf6d1eca8/href">https://medium.com/media/08e1fc75391ce9b48ea75f2bf6d1eca8/href</a></iframe><pre><strong>validate.js</strong></pre><pre>This middleware is used to check if the express-validator middleware returns an error.</pre><pre>If so, it recreates the error object using the param and msg keys and returns the error.</pre><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/dca3661d952202a2a039b66786c8c1e9/href">https://medium.com/media/dca3661d952202a2a039b66786c8c1e9/href</a></iframe><h4>Step 7: Model</h4><p>In the models folder, create the file <strong>user.js .</strong></p><p>The User model is created using using the <strong>mongoose </strong>package. This model represent each user in the database.</p><pre><strong>pre-save </strong>hook<br>used to hash the user’s password using the <strong>bcrypt</strong> package whenever a user is created or their password is changed before saving in the database.<br>----</pre><pre><strong>comparePassword</strong> method <br>used to compare the password entered by the user during login to the user’s password currently in the database.</pre><pre>----</pre><pre><strong>generateJWT </strong>method<br>used for creating the authentication tokens using the <strong>jwt</strong> package. This token will be returned to the user and will be required for accessing protected routes.</pre><pre>The token payload includes the user’s first name, last name, username and email address and is set to expire 60 days in the future.</pre><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/b69b9efe657d5e3c11c5607928ea2e20/href">https://medium.com/media/b69b9efe657d5e3c11c5607928ea2e20/href</a></iframe><h4>Step 8: Controller</h4><p>In the controllers folder, create two js files <strong>auth.js </strong><strong>user.js </strong>.</p><pre><strong>auth.js<br></strong>The authentication controller includes the following functions.<br></pre><pre><strong>register<br></strong>the database is queried using the email address to check if the user already exist.</pre><pre>If the user&#39;s doesn&#39;t exist, a new user is created and the <strong>generateJWT</strong> method is called to generate the authentication token which is then passed to the user along with the user object.</pre><pre>--</pre><pre><strong>login</strong></pre><pre>the database is queried using the email address to check if the user exist.</pre><pre>If the user is found, the user object is used to call the <strong>comparePassword </strong>method.</pre><pre>If the comparison is successful<strong>, </strong>the <strong>generateJWT</strong> method is called to generate the authentication token which is then passed to the user along with the user object.</pre><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/a272df0ce05d2dbd8281626dbc4a6f53/href">https://medium.com/media/a272df0ce05d2dbd8281626dbc4a6f53/href</a></iframe><h4><strong>user.js</strong></h4><p>In this file, the <strong>multer</strong> package is used to create the middleware <strong>multer_upload </strong>which<strong> </strong>accept a single file with the field name<strong> </strong><strong>profileImage</strong>. This file is stored in <strong>req.file</strong> which is later accessed in the controller.</p><pre><strong>update</strong></pre><pre>checks if the ‘request has a ‘file’ key, if so, the upload function is called passing the request and response.</pre><pre>If not the user id is extracted from the request, an update object is created using the request body and Mongoose <strong>findByIdAndUpdate </strong>is used to query and update the user’s data.</pre><pre>--</pre><pre><strong>upload</strong></pre><pre>the <strong>multer_upload </strong>middleware previously created is used to check if a file exist, if so, the<strong> </strong>Datauri package is used to recreate the image using the &#39;buffer&#39; key in &#39;req.file&#39;</pre><pre>The create image&#39;s content is then passed to cloudinary.uploader upload function. if the upload is successful, the url is added to the user&#39;s object and the it&#39;s saved.</pre><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/8d4ab7e59cef22dd51d544aec247069a/href">https://medium.com/media/8d4ab7e59cef22dd51d544aec247069a/href</a></iframe><h4>Step 9: Routes</h4><p>In the routes folder, create three js files auth.js user.js index.js<strong><em> </em></strong>.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/58d46cbbdde8ddfff7f4633da4b328a6/href">https://medium.com/media/58d46cbbdde8ddfff7f4633da4b328a6/href</a></iframe><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/c392d3bfbcbafa5af88b962c202826bc/href">https://medium.com/media/c392d3bfbcbafa5af88b962c202826bc/href</a></iframe><pre><strong>index.js</strong></pre><pre>The /api/auth uses the auth routes.<br>The /api/user uses the user routes.</pre><pre>A middleware is attached to the <strong>user </strong>endpoint, the middleware checks and authenticates the jwt token passed before accessing the user routes.</pre><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/4355fa7c63fb699fb44d2b1df0ae45db/href">https://medium.com/media/4355fa7c63fb699fb44d2b1df0ae45db/href</a></iframe><h4>Step 10: Create Server</h4><p>Update the server.js file.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/e8c3a78c32e7d0eb4d93b3409019a191/href">https://medium.com/media/e8c3a78c32e7d0eb4d93b3409019a191/href</a></iframe><p>Run the command below to start the server</p><pre>npm start</pre><pre>&lt;&lt; - OUTPUT<br>Server running on <a href="http://localhost:3000/">http://localhost:3000/</a><br>MongoDB --  database connection established successfully!<br>&gt;&gt;</pre><h4>Testing</h4><p>Use <a href="https://www.getpostman.com/">Postman</a> to test.</p><p><strong>User Index</strong><br>Try accessing the user index. /api/user</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/800/1*-qGEaczW8BXdWYN0xF7DiQ.gif" /><figcaption>User Index</figcaption></figure><p><strong>Register</strong><br>Create a POST request to /api/auth/register .</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/800/1*O6vZ1wFwe2mttYejmTa99Q.gif" /><figcaption>Registration</figcaption></figure><p><strong>Login</strong><br>Create a POST request to /api/auth/login .</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/800/1*JoIqO4Nb5JKReiPCxKN3kA.gif" /><figcaption>Login</figcaption></figure><p><strong>Update User Info</strong><br>Try updating the user information using endpoint/api/user/update passing the token from either the registration or login.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/800/1*xPqY53ExnD1nKMYEOD3N_w.gif" /><figcaption>Update User Info</figcaption></figure><p><strong>Upload Profile Image</strong><br>Try uploading a profile image using endpoint/api/user/upload passing the token from either the registration or login.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/600/1*b_7CWu7Q4W8IQblCzP4w6Q.gif" /><figcaption>Upload Profile Image</figcaption></figure><p><strong>Register with existing email/username</strong><br>Attempt to register with the email address you used in the previous test.</p><p>In the next <a href="https://medium.com/mesan-digital/tutorial-3b-how-to-add-password-reset-to-your-node-js-authentication-api-using-sendgrid-ada54c8c0d1f">tutorial</a>, we will add <a href="https://medium.com/mesan-digital/tutorial-3b-how-to-add-password-reset-to-your-node-js-authentication-api-using-sendgrid-ada54c8c0d1f">password reset</a> functionality.</p><h3>That’s all folks!</h3><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fgiphy.com%2Fembed%2F13eGggdZuzojhC%2Ftwitter%2Fiframe&amp;url=https%3A%2F%2Fgiphy.com%2Fgifs%2Flegacy-13eGggdZuzojhC&amp;image=https%3A%2F%2Fmedia.giphy.com%2Fmedia%2F13eGggdZuzojhC%2Fgiphy.gif&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=giphy" width="435" height="244" frameborder="0" scrolling="no"><a href="https://medium.com/media/6bdcc913a9f913d9d67375528592c3ba/href">https://medium.com/media/6bdcc913a9f913d9d67375528592c3ba/href</a></iframe><h3>Related Tutorials</h3><ol><li>Tutorial 3b: <a href="https://medium.com/mesan-digital/tutorial-3b-how-to-add-password-reset-to-your-node-js-authentication-api-using-sendgrid-ada54c8c0d1f">How to Add Password Reset to Your Node.js Authentication API using SendGrid</a></li></ol><h3>Other Tutorials</h3><ol><li>Tutorial 4: <a href="https://medium.com/@mosesesan/tutorial-4-how-to-build-a-laravel-5-4-jwt-powered-mobile-app-api-4c59109d35f">How to Build a Laravel 5.4 JWT-Powered Mobile App Authentication API</a></li><li>Tutorial 5: <a href="https://medium.com/@mosesesan/tutorial-5-how-to-build-a-laravel-5-4-jwt-authentication-api-with-e-mail-verification-61d3f356f823">How to Build a Laravel 5.4 JWT Authentication API with E-Mail Verification</a></li><li>Tutorial 6 &amp; 7: <a href="https://medium.com/@mosesesan/tutorial-6-how-to-build-a-laravel-5-4-4ba44f26b853">How to Build a Laravel 5.4 Administration Module with Role-based permissions using Entrust package</a></li></ol><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=a998838de6a2" width="1" height="1" alt=""><hr><p><a href="https://medium.com/mesan-digital/tutorial-3a-how-to-build-a-node-js-a998838de6a2">How to Build a Node.js Authentication API using JWT, MongoDB, Express.js and Passport.js</a> was originally published in <a href="https://medium.com/mesan-digital">Mesan Digital</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[How to add CRUD operations to your React Native app using React Hooks and Redux]]></title>
            <description><![CDATA[<div class="medium-feed-item"><p class="medium-feed-image"><a href="https://medium.com/mesan-digital/tutorial-2a-how-to-add-crud-operations-to-your-react-native-app-using-react-hooks-and-redux-5896ebab89ea?source=rss-35e62dce4e81------2"><img src="https://cdn-images-1.medium.com/max/600/1*GpS4NzRPIwO_WXIce9DyGQ.gif" width="600"></a></p><p class="medium-feed-snippet">Add CRUD (Create, Read, Update and delete) operations to your React Native app.</p><p class="medium-feed-link"><a href="https://medium.com/mesan-digital/tutorial-2a-how-to-add-crud-operations-to-your-react-native-app-using-react-hooks-and-redux-5896ebab89ea?source=rss-35e62dce4e81------2">Continue reading on Mesan Digital »</a></p></div>]]></description>
            <link>https://medium.com/mesan-digital/tutorial-2a-how-to-add-crud-operations-to-your-react-native-app-using-react-hooks-and-redux-5896ebab89ea?source=rss-35e62dce4e81------2</link>
            <guid isPermaLink="false">https://medium.com/p/5896ebab89ea</guid>
            <category><![CDATA[react-hook]]></category>
            <category><![CDATA[react]]></category>
            <category><![CDATA[redux]]></category>
            <category><![CDATA[react-native]]></category>
            <category><![CDATA[crud-operations]]></category>
            <dc:creator><![CDATA[Moses Esan]]></dc:creator>
            <pubDate>Mon, 23 Sep 2019 17:00:15 GMT</pubDate>
            <atom:updated>2019-11-08T09:38:46.129Z</atom:updated>
        </item>
        <item>
            <title><![CDATA[React Native with  React Hooks and Redux Boilerplate]]></title>
            <description><![CDATA[<div class="medium-feed-item"><p class="medium-feed-image"><a href="https://medium.com/mesan-digital/tutorial-1a-react-native-with-react-hooks-and-redux-boilerplate-75014ca8dee4?source=rss-35e62dce4e81------2"><img src="https://cdn-images-1.medium.com/max/600/1*9CXeoM6LEMQvXIcRz4CbRw.gif" width="600"></a></p><p class="medium-feed-snippet">Boilerplate for a React Native iOS and Android app using React Hooks and Redux.</p><p class="medium-feed-link"><a href="https://medium.com/mesan-digital/tutorial-1a-react-native-with-react-hooks-and-redux-boilerplate-75014ca8dee4?source=rss-35e62dce4e81------2">Continue reading on Mesan Digital »</a></p></div>]]></description>
            <link>https://medium.com/mesan-digital/tutorial-1a-react-native-with-react-hooks-and-redux-boilerplate-75014ca8dee4?source=rss-35e62dce4e81------2</link>
            <guid isPermaLink="false">https://medium.com/p/75014ca8dee4</guid>
            <category><![CDATA[redux]]></category>
            <category><![CDATA[tutorial]]></category>
            <category><![CDATA[expo]]></category>
            <category><![CDATA[react-native]]></category>
            <category><![CDATA[react-hook]]></category>
            <dc:creator><![CDATA[Moses Esan]]></dc:creator>
            <pubDate>Wed, 18 Sep 2019 12:01:44 GMT</pubDate>
            <atom:updated>2019-11-08T09:37:06.022Z</atom:updated>
        </item>
        <item>
            <title><![CDATA[How to build a News App with React Native (Part 2) (Home Module)]]></title>
            <link>https://medium.com/mesan-digital/how-to-build-a-news-app-with-react-native-part-2-home-module-2308c9a6b6a1?source=rss-35e62dce4e81------2</link>
            <guid isPermaLink="false">https://medium.com/p/2308c9a6b6a1</guid>
            <category><![CDATA[react]]></category>
            <category><![CDATA[react-native]]></category>
            <category><![CDATA[redux]]></category>
            <category><![CDATA[mobile-app-development]]></category>
            <dc:creator><![CDATA[Moses Esan]]></dc:creator>
            <pubDate>Thu, 01 Nov 2018 16:45:15 GMT</pubDate>
            <atom:updated>2019-04-30T11:46:36.043Z</atom:updated>
            <content:encoded><![CDATA[<p><em>Please note that this tutorial assumes you have some JavaScript or React Native experience, this tutorial does not explain each line of the code instead it presents you with the code and gives you an overview of what the code does and points out the important parts of the code. I have made the code as simple as possible, if you have any questions, please do not hesitate to leave a comment.</em></p><p>In <a href="https://medium.com/@mosesesan/how-to-build-a-news-app-with-react-native-app-part-1-e78d7d3c55b3">Part 1</a>, we created our app, installed the required dependencies, set up the project folder structure and configured the app.</p><p>In Part 2, we will create the home module.</p><h4>Step 1: Setup</h4><p>In the <strong>modules</strong> folder, we will create the <strong>home</strong> module, in that module, we will create 2 folders, <strong><em>components</em></strong>, and <strong><em>scenes </em></strong>and<strong> </strong>4 js files, <strong>index.js</strong>, <strong>constants.js</strong>, <strong>action.js</strong> and <strong>reducer.js.</strong></p><pre><strong>Make sure you are in the project root</strong></pre><pre>$ cd app/modules<br>$ mkdir home &amp;&amp; cd home</pre><pre><strong>Folders<br></strong>$ mkdir components scenes</pre><pre><strong>JS files<br></strong>$ touch index.js constants.js actions.js reducer.js</pre><p><strong>Index</strong></p><p>Update the <strong>index.js</strong> file with the code below. This will be the entry point into our home module, in this file we will import the actions, constants, reducer and theme file and then export them all as part of an object.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/26be148b85003705fc802a488118252f/href">https://medium.com/media/26be148b85003705fc802a488118252f/href</a></iframe><p><strong>Constants</strong></p><p>Update the <strong>constants.js</strong> file with the code below. In this file, we will declare the name of this module, the action types to be used by redux, the Newsapi.org API url and the API key.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/649f610f874f0312b83d542c29a0a4c6/href">https://medium.com/media/649f610f874f0312b83d542c29a0a4c6/href</a></iframe><h4>Step 2: Redux</h4><p><strong>Redux Actions</strong></p><p>Update the <strong>actions.js</strong> file with the code below. First, we import the <strong>axios </strong>plugin so we can make API calls, and import the <strong>constants</strong> file so we have access to the API URL and API KEY previously declared.</p><p>Next, we create the <strong><em>getNewsHeadlines </em></strong>function in charge of calling the Newsapi.org API to retrieve the news headlines, it takes in the “<strong>country</strong>” as a parameter and defaults to “us” (United States), if the country parameter is not passed.</p><p>If the API call is successful, the returned data is dispatched to the reducer, if an error occurs, the error object is dispatched to the reducer.</p><p>The <strong><em>getHeadlinesBySource </em></strong>function retrieve the news headlines for a specific source, it takes in the “<strong>source</strong>” as a parameter.</p><p>Note that the <strong><em>getHeadlinesBySource</em></strong><em> </em>does not dispatch the returned data or error to the reducer, instead it is returned to the scene that called it and that scene saves the data in its state.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/54f8f02e365a47155cd2257f7c3da910/href">https://medium.com/media/54f8f02e365a47155cd2257f7c3da910/href</a></iframe><p><strong>Redux Reducer</strong></p><p>Update the <strong>reducer.js</strong> file with the code below. It’s the reducer’s job to decide if it needs to modify the app state or not based on the action dispatched to it.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/e6d2f1ee89a119bd76ed6a2b1ca8ec97/href">https://medium.com/media/e6d2f1ee89a119bd76ed6a2b1ca8ec97/href</a></iframe><p><strong>Root Reducer</strong></p><p>To complete the Redux setup for this module, we will add the newly created reducer to the root reducer so how scenes can have access to them.</p><p>Update the <strong><em>rootReducer.js</em></strong> file.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/0dc5b1a98b2c7dd2e45810bb8e4afccd/href">https://medium.com/media/0dc5b1a98b2c7dd2e45810bb8e4afccd/href</a></iframe><h4>Step 3: Scenes</h4><p><strong>Components</strong></p><p>Before creating the scene, we need to first create our <strong><em>NewsItem </em></strong>component, this component will display the info for each headline, it will be a view with an image and 3 textfields for displaying the headline article image, title, date published and source.</p><p>When the source textfield is pressed, the app will navigate to a new scene that displays the headline articles for a specific source.</p><p>When the component is pressed, the app will navigate to a new scene that displays the article.</p><pre><strong>Make sure you are in the project root</strong></pre><pre>$ cd app/modules/home/components<br>$ mkdir NewsItem &amp;&amp; cd NewsItem</pre><pre><strong>JS files<br></strong>$ touch index.js styles.js</pre><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/62094feecaa454b0c3e424a2c126b159/href">https://medium.com/media/62094feecaa454b0c3e424a2c126b159/href</a></iframe><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/9d897d9cbeee7db77db309175278bedf/href">https://medium.com/media/9d897d9cbeee7db77db309175278bedf/href</a></iframe><p><strong>Home Scene</strong></p><p>Our <strong>Home </strong>scene will include just a Flatlist that will be display all articles with the help of the <strong>NewsItem</strong> component.</p><pre><strong>Make sure you are in the project root</strong></pre><pre>$ cd app/modules/home/scenes<br>$ mkdir Home &amp;&amp; cd Home</pre><pre><strong>JS file(s)<br></strong>$ touch index.js</pre><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/9b059c73baa10a86ac113ddbc2236e79/href">https://medium.com/media/9b059c73baa10a86ac113ddbc2236e79/href</a></iframe><p><strong>Source Scene</strong></p><p>Our <strong>Source </strong>scene is very similar to the Home scene but it only displays articles from a specific source and also doesn’t store its data in the redux store instead it uses the scenes <strong>state</strong>.</p><pre><strong>Make sure you are in the project root</strong></pre><pre>$ cd app/modules/home/scenes<br>$ mkdir Source &amp;&amp; cd Source</pre><pre><strong>JS file(s)<br></strong>$ touch index.js</pre><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/e4f1d8f798e9fdb25edb09af3c6f4484/href">https://medium.com/media/e4f1d8f798e9fdb25edb09af3c6f4484/href</a></iframe><p><strong>Article Scene</strong></p><p>Our <strong>Article </strong>scene has a Webview for displaying the article using its url.</p><pre><strong>Make sure you are in the project root</strong></pre><pre>$ cd app/modules/home/scenes<br>$ mkdir Article &amp;&amp; cd Article</pre><pre><strong>JS file(s)<br></strong>$ touch index.js</pre><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/84370109eeb33fe24439f80797238beb/href">https://medium.com/media/84370109eeb33fe24439f80797238beb/href</a></iframe><h4>Step 4: Link It all together</h4><p><strong>Routes</strong><br>Now that the scenes are ready, we need to add them to our routes file, update the <strong><em>routes.js</em></strong> file.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/b79286c597b4b7ee921217acbf4a8197/href">https://medium.com/media/b79286c597b4b7ee921217acbf4a8197/href</a></iframe><p><strong>Routes</strong><br><strong>Entry Point</strong><br>We need to update the <strong><em>App.js</em></strong> file, with a reducer now available, it’s time to wrap our app’s Router with our Provider.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/6488f79a46b358d8e5cad64c152ad661/href">https://medium.com/media/6488f79a46b358d8e5cad64c152ad661/href</a></iframe><p>Run the command below to test the app, This will start a development server for you. Download the Expo app to test.</p><pre>$ expo start</pre><h3>Thats all folks!</h3><h4>Related Tutorials</h4><ol><li><a href="https://medium.com/@mosesesan/how-to-build-a-news-app-with-react-native-app-part-1-e78d7d3c55b3">How to build a News App with React Native (Part 1)</a></li></ol><h4>React Native Tutorials</h4><ol><li>Tutorial 1: <a href="https://medium.com/@mosesesan/tutorial-react-native-redux-boilerplate-4899f5c4f431">React Native Redux Boilerplate</a></li><li>Tutorial 2: <a href="https://medium.com/@mosesesan/tutorial-react-native-redux-with-crud-operations-cdb449538886">React Native Redux with CRUD operations</a></li><li><a href="https://medium.com/@mosesesan/how-to-build-a-react-native-app-using-firebase-part-1-1210fa206714">How to build a React Native App using Firebase. (Part 1)</a> (Setup)</li><li><a href="https://medium.com/@mosesesan/how-to-build-a-react-native-app-using-firebase-part-2-f2934da0926d">How to build a React Native App using Firebase. (Part 2)</a> (Backend)</li><li><a href="https://medium.com/@mosesesan/how-to-build-a-react-native-app-using-firebase-part-3-6d2069e82e5a">How to build a React Native App using Firebase. (Part 3)</a> (Frontend)</li><li><a href="https://medium.com/@mosesesan/how-to-build-a-react-native-app-using-firebase-part-4-facebook-login-ea67929efdfe">How to build a React Native App using Firebase. (Part 4)</a>(Facebook Login)</li><li><a href="https://medium.com/@mosesesan/how-to-build-a-react-native-app-using-firebase-part-5-crud-4f6c60bbe733">How to build a React Native App using Firebase. (Part 5)</a>(CRUD)</li></ol><h4>Other Tutorials</h4><ol><li>Tutorial 4: <a href="https://medium.com/@mosesesan/tutorial-4-how-to-build-a-laravel-5-4-jwt-powered-mobile-app-api-4c59109d35f">How to Build a Laravel 5.4 JWT-Powered Mobile App Authentication API</a></li><li>Tutorial 5: <a href="https://medium.com/@mosesesan/tutorial-5-how-to-build-a-laravel-5-4-jwt-authentication-api-with-e-mail-verification-61d3f356f823">How to Build a Laravel 5.4 JWT Authentication API with E-Mail Verification</a></li><li>Tutorial 6 &amp; 7: <a href="https://medium.com/@mosesesan/tutorial-6-how-to-build-a-laravel-5-4-4ba44f26b853">How to Build a Laravel 5.4 Administration Module with Role-based permissions using Entrust package</a></li></ol><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=2308c9a6b6a1" width="1" height="1" alt=""><hr><p><a href="https://medium.com/mesan-digital/how-to-build-a-news-app-with-react-native-part-2-home-module-2308c9a6b6a1">How to build a News App with React Native (Part 2) (Home Module)</a> was originally published in <a href="https://medium.com/mesan-digital">Mesan Digital</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[How to build a News App with React Native App (Part 1)]]></title>
            <link>https://medium.com/mesan-digital/how-to-build-a-news-app-with-react-native-app-part-1-e78d7d3c55b3?source=rss-35e62dce4e81------2</link>
            <guid isPermaLink="false">https://medium.com/p/e78d7d3c55b3</guid>
            <category><![CDATA[react]]></category>
            <category><![CDATA[crna]]></category>
            <category><![CDATA[redux]]></category>
            <category><![CDATA[mobile-app-development]]></category>
            <category><![CDATA[react-native]]></category>
            <dc:creator><![CDATA[Moses Esan]]></dc:creator>
            <pubDate>Thu, 01 Nov 2018 16:42:01 GMT</pubDate>
            <atom:updated>2018-11-03T11:36:18.381Z</atom:updated>
            <content:encoded><![CDATA[<h3>How to build a News App with React Native (Part 1)</h3><p><em>Please note that this tutorial assumes you have some JavaScript or React Native experience, this tutorial does not explain each line of the code instead it presents you with the code and gives you an overview of what the code does and points out the important parts of the code. I have made the code as simple as possible, if you have any questions, please do not hesitate to leave a comment.</em></p><p>In this tutorial, we will build a News app with React Native that uses the <a href="https://newsapi.org/">newsapi.org</a> API to retrieve the top headlines.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/600/1*KOFFKk24Y1J23l3TqC6eRQ.gif" /><figcaption><strong>Demo</strong></figcaption></figure><p>Now, that we have gotten that out of the way, <strong>LET THE CODING BEGIN!</strong></p><h4>Step 0: Register for News API key</h4><p>Follow the <a href="https://newsapi.org/register">link</a> to register for an API key<strong>.</strong></p><h4>Step 1: Getting Started</h4><p>If this is your first time creating a React Native app, make sure you have <a href="https://nodejs.org/en/download/">Node</a>, <a href="https://www.npmjs.com/get-npm">npm</a> or <a href="https://yarnpkg.com/lang/en/docs/install/">yarn</a> installed. For this project, I will be using yarn and <a href="https://github.com/react-community/create-react-native-app">create-react-native-app</a> which has been dubbed as the easiest way to start building a new React Native app.</p><p>There are many advantages to using <a href="https://github.com/react-community/create-react-native-app">CRNA</a>, one being that it allows you to start a project without installing or configuring any tools to build native code — no Xcode or Android Studio installation required and you can install the <a href="https://expo.io/">Expo</a> app on your iOS or Android phone for testing.</p><p>Before we begin, we have to globally install the create-react-native-app command line utility and Expo CLI using npm or yarn.</p><p>Open up your terminal and run one of the commands below depending on whether you are using npm or yarn.</p><pre>$ npm install -g create-react-native-app<br>$ npm install -g expo-cli</pre><pre><strong>or</strong></pre><pre>$ yarn global add create-react-native-app<br>$ yarn global add expo-cli</pre><p>Now that CRNA is installed, we can create a new project by running the command below:</p><pre>$ create-react-native-app news-rn-app<br>$ cd news-rn-app/<br>$ npm install</pre><h4>Step 2: Install Dependencies</h4><p>We will be using the following packages:</p><ul><li><a href="https://github.com/reactjs/redux/">Redux</a> for managing the app’s state</li><li><a href="https://github.com/reactjs/react-redux">React-Redux</a>, will be used to connect our app’s components to the redux store.</li><li><a href="https://github.com/gaearon/redux-thunk">Redux Thunk</a> is a middleware for Redux that allows us to write action creators that return a function instead of an action.</li><li><a href="https://github.com/aksonov/react-native-router-flux">React Native Router Flux</a> for our apps navigation,</li><li><a href="https://github.com/react-native-training/react-native-elements">React Native Elements</a> as our UI Toolkit,</li><li><a href="https://github.com/nirsky/react-native-size-matters">React Native Size Matters</a> for scaling the size your apps UI across different sized devices,</li><li><a href="https://github.com/mzabriskie/axios">Axios</a>, a promised-based HTTP client for making calls to our API</li><li><a href="https://momentjs.com/">Moment.js</a></li></ul><pre>$ yarn add redux react-redux redux-thunk<br>$ yarn add react-native-router-flux<br>$ yarn add react-native-elements<br>$ yarn add react-native-size-matters<br>$ yarn add axios<br>$ yarn add<strong> </strong>moment</pre><pre><strong>Or</strong></pre><pre>$ yarn add redux react-redux redux-thunk react-native-router-flux react-native-elements react-native-size-matters axios moment</pre><p>Before we continue, run the command below to test the app, This will start a development server for you, and print a QR code in your terminal. If you are using the Expo app, you can scan the QR code.</p><pre>$ expo start</pre><h4>Step 3: Create Folder Structure</h4><p>For this project, I will be organizing the directory <strong>by feature/module</strong>. To find out more about organising by feature/module, read this <a href="https://jaysoo.ca/2016/02/28/organizing-redux-application/">article</a> or <a href="http://engineering.kapost.com/2016/01/organizing-large-react-applications/">this</a> or <a href="https://marmelab.com/blog/2015/12/17/react-directory-structure.html">this</a> or <a href="https://medium.com/@alexmngn/how-to-better-organize-your-react-applications-2fd3ea1920f1">this</a> to get a better understanding and see the advantages of organizing your project this way.</p><p>In your project root create an <strong>app</strong> folder, in that folder, we will create 6 additional folders, <strong><em>assets</em></strong>, <strong><em>config</em></strong>, <strong><em>components</em></strong>, <strong><em>modules</em></strong>, <strong><em>redux</em></strong> and <strong><em>styles</em>.</strong></p><pre><strong>Make sure you are in the project root</strong></pre><pre>$ mkdir app &amp;&amp; cd app<br>$ mkdir assets config components modules redux styles</pre><pre><strong>Config<br></strong>$ cd config &amp;&amp; touch constants.js routes.js request.js &amp;&amp; cd ..</pre><pre><strong>Redux<br></strong>$ cd redux &amp;&amp; touch rootReducer.js store.js &amp;&amp; cd ..</pre><pre><strong>Styles<br></strong>$ cd styles &amp;&amp; touch theme.js &amp;&amp; cd ..</pre><pre><strong>Or</strong></pre><pre>$ mkdir app &amp;&amp; cd app &amp;&amp; mkdir assets config components modules redux styles &amp;&amp; cd config &amp;&amp; touch constants.js routes.js request.js &amp;&amp; cd .. &amp;&amp; cd redux &amp;&amp; touch rootReducer.js store.js &amp;&amp; cd .. &amp;&amp; cd styles &amp;&amp; touch theme.js &amp;&amp; cd ..</pre><h4>Step 4: Configuration</h4><p><strong>Redux</strong><br>We will configure the app for Redux. We will set up the Root Reducer and Store.</p><p><strong>Reducer</strong><br>The reducers are the in charge of updating the state of our app. In the <strong>redux </strong>folder, update the <strong><em>rootReducer.js</em></strong> file. In this file, we will import the reducers from our modules and use redux <strong><em>combineReducers</em></strong> function to merge them together into a single state object that we will later use to create our redux store.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/e27d1dae6f991cc095de6422eafb4f3e/href">https://medium.com/media/e27d1dae6f991cc095de6422eafb4f3e/href</a></iframe><p><strong>Store</strong><br>In the <strong>redux</strong> folder, create the <strong><em>store.js</em></strong> file. In this file we will create our redux store by importing our root reducer and injecting our store enhancers, i.e. <a href="https://github.com/gaearon/redux-thunk">Redux Thunk</a>.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/617600c16b4d0fed6635e4331000612c/href">https://medium.com/media/617600c16b4d0fed6635e4331000612c/href</a></iframe><p><strong>Routes</strong><br>In the <strong>app/config</strong> folder, update the <strong><em>routes.js</em></strong> file. In this file we will set up our Router and Scenes, check <a href="https://github.com/aksonov/react-native-router-flux">React Native Router</a> repo for more information about the basic setup.</p><p>For now, we will add a default scene.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/b16ab860416b4137cb4632d277fba780/href">https://medium.com/media/b16ab860416b4137cb4632d277fba780/href</a></iframe><p><strong>Entry Point</strong><br>The <strong><em>App.js</em></strong> file is the entry point into our app. In this file, we import our routes and store. We then connect our provider to our store which will let our app scenes access our app’s state and then wrap our app’s Router with our Provider.</p><p>For now, we will not wrap the app’s Router with the Provider as we don’t have any reducers yet.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/347cfb1c4b6b813575df3ff46cbee8b3/href">https://medium.com/media/347cfb1c4b6b813575df3ff46cbee8b3/href</a></iframe><p><strong>Theme</strong><br>Last but not least, we will create the theme file, in this file we will declare our font sizes, colors, font family and more. In the <strong>styles </strong>folder<strong>, </strong>update<strong> </strong>the <strong><em>theme.js</em></strong><em> </em>file and paste the code below.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/02a21f3537c10cb75c2419a5ba495b05/href">https://medium.com/media/02a21f3537c10cb75c2419a5ba495b05/href</a></iframe><p>Run the command below to test the app, This will start a development server for you. Download the Expo app to test.</p><pre>$ expo start</pre><p>In <a href="https://medium.com/@mosesesan/how-to-build-a-news-app-with-react-native-part-2-home-module-2308c9a6b6a1">Part 2</a>, we will create our Home module.</p><h3>Thats all folks!</h3><h4>Related Tutorials</h4><ol><li><a href="https://medium.com/@mosesesan/how-to-build-a-news-app-with-react-native-part-2-home-module-2308c9a6b6a1">How to build a News App with React Native (Part 2) (Home Module)</a></li></ol><h4>React Native Tutorials</h4><ol><li>Tutorial 1: <a href="https://medium.com/@mosesesan/tutorial-react-native-redux-boilerplate-4899f5c4f431">React Native Redux Boilerplate</a></li><li>Tutorial 2: <a href="https://medium.com/@mosesesan/tutorial-react-native-redux-with-crud-operations-cdb449538886">React Native Redux with CRUD operations</a></li><li><a href="https://medium.com/@mosesesan/how-to-build-a-react-native-app-using-firebase-part-1-1210fa206714">How to build a React Native App using Firebase. (Part 1)</a> (Setup)</li><li><a href="https://medium.com/@mosesesan/how-to-build-a-react-native-app-using-firebase-part-2-f2934da0926d">How to build a React Native App using Firebase. (Part 2)</a> (Backend)</li><li><a href="https://medium.com/@mosesesan/how-to-build-a-react-native-app-using-firebase-part-3-6d2069e82e5a">How to build a React Native App using Firebase. (Part 3)</a> (Frontend)</li><li><a href="https://medium.com/@mosesesan/how-to-build-a-react-native-app-using-firebase-part-4-facebook-login-ea67929efdfe">How to build a React Native App using Firebase. (Part 4)</a>(Facebook Login)</li><li><a href="https://medium.com/@mosesesan/how-to-build-a-react-native-app-using-firebase-part-5-crud-4f6c60bbe733">How to build a React Native App using Firebase. (Part 5)</a>(CRUD)</li></ol><h4>Other Tutorials</h4><ol><li>Tutorial 4: <a href="https://medium.com/@mosesesan/tutorial-4-how-to-build-a-laravel-5-4-jwt-powered-mobile-app-api-4c59109d35f">How to Build a Laravel 5.4 JWT-Powered Mobile App Authentication API</a></li><li>Tutorial 5: <a href="https://medium.com/@mosesesan/tutorial-5-how-to-build-a-laravel-5-4-jwt-authentication-api-with-e-mail-verification-61d3f356f823">How to Build a Laravel 5.4 JWT Authentication API with E-Mail Verification</a></li><li>Tutorial 6 &amp; 7: <a href="https://medium.com/@mosesesan/tutorial-6-how-to-build-a-laravel-5-4-4ba44f26b853">How to Build a Laravel 5.4 Administration Module with Role-based permissions using Entrust package</a></li></ol><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=e78d7d3c55b3" width="1" height="1" alt=""><hr><p><a href="https://medium.com/mesan-digital/how-to-build-a-news-app-with-react-native-app-part-1-e78d7d3c55b3">How to build a News App with React Native App (Part 1)</a> was originally published in <a href="https://medium.com/mesan-digital">Mesan Digital</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
    </channel>
</rss>