<?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 PHPEXPERTISE on Medium]]></title>
        <description><![CDATA[Stories by PHPEXPERTISE on Medium]]></description>
        <link>https://medium.com/@phpxpertise?source=rss-5fee6db85a97------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*Zdtmg_hXxxFixEAIst4btA.jpeg</url>
            <title>Stories by PHPEXPERTISE on Medium</title>
            <link>https://medium.com/@phpxpertise?source=rss-5fee6db85a97------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Tue, 17 Nov 2026 20:24:50 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@phpxpertise/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[How to Install Lightworks Video Editor on Ubuntu 20.04 LTS]]></title>
            <link>https://medium.com/@phpxpertise/how-to-install-lightworks-video-editor-on-ubuntu-20-04-lts-8af14ff9d8b6?source=rss-5fee6db85a97------2</link>
            <guid isPermaLink="false">https://medium.com/p/8af14ff9d8b6</guid>
            <category><![CDATA[php-expertise]]></category>
            <category><![CDATA[worklight]]></category>
            <category><![CDATA[video-editor]]></category>
            <category><![CDATA[free-video-software]]></category>
            <category><![CDATA[ubuntu]]></category>
            <dc:creator><![CDATA[PHPEXPERTISE]]></dc:creator>
            <pubDate>Wed, 17 Mar 2021 02:50:43 GMT</pubDate>
            <atom:updated>2021-03-17T02:50:43.347Z</atom:updated>
            <content:encoded><![CDATA[<p>In Ubuntu, Lightworks is a free powerful Video editing tool that runs on Windows, Linux and macOS. In this tutorial guide helps you the steps to download and install Lightworks Video Editor on Ubuntu.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/985/1*P6zDaGWZIJxT7SXcKJXQrQ.png" /></figure><p>Read the installation steps on our blog: <a href="https://www.phpexpertise.com/how-to-install-lightworks-video-editor-on-ubuntu-20-04-lts/">https://www.phpexpertise.com/how-to-install-lightworks-video-editor-on-ubuntu-20-04-lts/</a></p><p>Watch the installation steps on youtube: <a href="https://youtu.be/V-D1s67ICns">https://youtu.be/V-D1s67ICns</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=8af14ff9d8b6" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[How to Install Google Chrome in Ubuntu 20.04 LTS]]></title>
            <link>https://medium.com/@phpxpertise/how-to-install-google-chrome-in-ubuntu-20-04-lts-742bd46ff7de?source=rss-5fee6db85a97------2</link>
            <guid isPermaLink="false">https://medium.com/p/742bd46ff7de</guid>
            <category><![CDATA[development]]></category>
            <category><![CDATA[learning-to-code]]></category>
            <category><![CDATA[ubuntu]]></category>
            <category><![CDATA[learning]]></category>
            <category><![CDATA[google-chrome]]></category>
            <dc:creator><![CDATA[PHPEXPERTISE]]></dc:creator>
            <pubDate>Thu, 11 Feb 2021 17:40:05 GMT</pubDate>
            <atom:updated>2021-02-13T12:59:00.049Z</atom:updated>
            <content:encoded><![CDATA[<p>In this tutorial, we explained about <strong>How to Install Google Chrome in Ubuntu 20.04 LTS</strong>. In Ubuntu, we can easily to install the Google chrome using Terminal command line. The commands are very simple and easy to use.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/985/0*JTqqX1MHCUFECS5R" /></figure><h3>Our Demonstration Video:</h3><h3>Installation Steps:</h3><p>Open terminal, Please do the below steps in the terminal.</p><p><strong>Step 1: </strong>wget <a href="https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb">https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb</a></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*ZK9UmpCGBg6AXSSm" /></figure><p><strong>Step 2</strong>: sudo apt install ./google-chrome-stable_current_amd64.deb</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*lEeoM1JUYuvUYPqs" /></figure><p><strong>Step 3: </strong>google-chrome</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/530/0*RusY9T9UETgDU655" /></figure><p>Google Chrome will open, and you’ll see the default Chrome welcome page.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*aBKaEma2hdVu7N4V" /></figure><p>Please visit the blog at <a href="https://www.phpexpertise.com/how-to-install-google-chrome-in-ubuntu-20-04-lts/">https://www.phpexpertise.com/how-to-install-google-chrome-in-ubuntu-20-04-lts/</a></p><p><em>Originally published at </em><a href="https://www.phpexpertise.com/how-to-install-google-chrome-in-ubuntu-20-04-lts/"><em>https://www.phpexpertise.com</em></a><em> on February 11, 2021.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=742bd46ff7de" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[How to Start XAMPP Automatically in Windows]]></title>
            <link>https://medium.com/@phpxpertise/how-to-start-xampp-automatically-in-windows-b404da94a0d8?source=rss-5fee6db85a97------2</link>
            <guid isPermaLink="false">https://medium.com/p/b404da94a0d8</guid>
            <category><![CDATA[windows-10]]></category>
            <category><![CDATA[apache]]></category>
            <category><![CDATA[xampp]]></category>
            <category><![CDATA[mysql]]></category>
            <category><![CDATA[windows]]></category>
            <dc:creator><![CDATA[PHPEXPERTISE]]></dc:creator>
            <pubDate>Thu, 28 Jan 2021 18:14:44 GMT</pubDate>
            <atom:updated>2021-01-30T08:00:24.075Z</atom:updated>
            <content:encoded><![CDATA[<p>In this post, we explained about <strong>How to start XAMPP automatically in Windows</strong>. If you want to auto start Apache and MySQL automatically in Windows 10, 8.1, and 7machines. Please do the below steps in your system. It might be helpful to launch the XAMPP in Windows.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/652/0*YWdXEbkXzc2YZkTT" /></figure><p><strong>Step 1:</strong> Open XAMPP in your system (C:\xampp)</p><p><strong>Step 2:</strong> Right click the xampp-control.exe file and Click <strong>Run as administrator</strong>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/400/0*eM89DicJhHLNz9Og" /></figure><p><strong>Step 3:</strong> Click <strong>Yes</strong> to continue and Click <strong>Config</strong> button in the xampp control panel.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/669/0*FN8Ngl6H5PpHftuI" /></figure><p><strong>Step 4:</strong> Click the <strong>Autostart of modules</strong> and choose Apache, MySQL and Tomcat check boxes in the box.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/360/0*lYMZeAneYWlTOczK" /></figure><p><strong>Step 5:</strong> Go to the XAMPP folder in your system(C:\xampp)</p><p>Right click the <strong>xampp-control.exe</strong> file and Choose <strong>Create shortcut </strong>option in the box.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/438/0*u9veqRhUYNAXzLg4" /></figure><p><strong>Step 6:</strong> Press Win+R and Open the <strong>Run</strong> dialog</p><p>Type <strong>shell:startup</strong> and Enter it.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/399/0*Gw8Dy-iIkBuse-EL" /></figure><p><strong>Step 7:</strong> New file explorer window has been opened and You need to drag the <strong>xampp-control — Shortcu</strong> t file from C:\xampp into new window.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/883/0*SSNl15faYgZqeSRi" /></figure><p>These steps are useful to auto start the XAMPP Control Panel in Windows.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/120/0*0qXW4lQMP9SgZhWS" /></figure><p>Visit our blog post at <a href="https://www.phpexpertise.com/how-to-start-xampp-automatically-in-windows/">https://www.phpexpertise.com/how-to-start-xampp-automatically-in-windows/</a></p><p><em>Originally published at </em><a href="https://www.phpexpertise.com/how-to-start-xampp-automatically-in-windows/"><em>https://www.phpexpertise.com</em></a><em> on January 28, 2021.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=b404da94a0d8" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[How to Generate and Store Massive data in Node.js]]></title>
            <link>https://medium.com/@phpxpertise/how-to-generate-and-store-massive-data-in-node-js-1772d18d2050?source=rss-5fee6db85a97------2</link>
            <guid isPermaLink="false">https://medium.com/p/1772d18d2050</guid>
            <category><![CDATA[fakers]]></category>
            <category><![CDATA[expressjs]]></category>
            <category><![CDATA[db-migration]]></category>
            <category><![CDATA[migration]]></category>
            <category><![CDATA[nodejs]]></category>
            <dc:creator><![CDATA[PHPEXPERTISE]]></dc:creator>
            <pubDate>Fri, 01 Jan 2021 09:35:55 GMT</pubDate>
            <atom:updated>2021-01-01T12:40:35.070Z</atom:updated>
            <content:encoded><![CDATA[<p>In this tutorial explains about <strong>How to Generate and Store Massive data in Node.js</strong>. When we build an application we need data to show off how it works. In Node.JS, we can generate massive amount of records by using .</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/652/0*JX2KFKooCXuOKUp9" /></figure><h4>Prerequisites:</h4><p><a href="https://www.npmjs.com/package/express">Express</a> — is a popular framework which is a most common framework used in node.js</p><p><a href="https://www.npmjs.com/package/faker">Faker.js</a> — generate massive amounts of fake data in the browser and node.js.</p><p><a href="https://www.npmjs.com/package/faker">db</a><a href="https://www.npmjs.com/package/db-migrate-mysql">-migrate-mysql</a> — used to db-migrate mysql driver.</p><p><a href="https://www.npmjs.com/package/faker">yargs</a> — It helps you build interactive command line tools, by parsing arguments and generating an elegant user interface.</p><h3>Install Packages:</h3><p>First, we need to install node application in your project folder.</p><pre>node -v npm init -y npm i db-migrate-mysql faker fs yargs express</pre><p>Your <strong><em>package.json </em></strong>file look like in the below</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/602/0*rQq1Yz_IDPeL8R56" /></figure><p>After the installation and create the following files and folders in your project directory.</p><pre>//root directory touch database.json mkdir migrations mkdir scripts cd scripts touch geneate-users.js</pre><p>In <strong><em>app.js</em></strong> file with following contents</p><pre>const express = require(&#39;express&#39;);<br><br>const port = 3000;<br><br>const app = express();<br><br>app.get(&#39;/&#39;, function (req, res) {<br>    res.send(&#39;hello world&#39;)<br>})<br><br>app.listen(port, () =&gt; {<br>    console.log(`Server running on port ${port}`)<br>})<br><br>module.exports = app;</pre><p>To run your application.</p><p><em>In Browser: </em><a href="http://localhost:3000/"><em>http://localhost:3000</em></a></p><h3>Create a database config:</h3><p>In <strong><em>database.json</em></strong> file with following contents</p><pre>{<br>    &quot;dev&quot;: {<br>        &quot;host&quot;: &quot;localhost&quot;,<br>        &quot;driver&quot;: &quot;mysql&quot;,<br>        &quot;user&quot;: &quot;root&quot;,<br>        &quot;password&quot;: &quot;&quot;,<br>        &quot;database&quot;: &quot;wallet&quot;,<br>        &quot;multipleStatements&quot;: true<br>    }, &quot;sql-file&quot;: true<br>}</pre><h3>Creating a new migration script for Users:</h3><pre>db-migrate create user</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/626/0*_pNAUVcDanUz4QO0" /></figure><blockquote><em>This command used to create a users table in mysql. It generate two sql files.</em></blockquote><blockquote><em>*-users-up.sql file — add your create query here.</em></blockquote><blockquote><em>*-users-down.sql file — add your drop table command here.</em></blockquote><p>In <strong><em>20210101074106-users-up.sql</em></strong> file with following contents</p><pre>/* Replace with your SQL commands */<br>CREATE TABLE `users` (<br>  `id` int(11) NOT NULL AUTO_INCREMENT,<br>  `name` varchar(40) DEFAULT NULL,<br>  `email` varchar(50) DEFAULT NULL,<br>  `balance` int(11) DEFAULT NULL,<br>  `createdAt` datetime DEFAULT CURRENT_TIMESTAMP,<br>  `updatedAt` datetime DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,<br>  PRIMARY KEY(id)<br>) ENGINE=InnoDB DEFAULT CHARSET=latin1;</pre><p>In <strong><em>20210101074106-users-down.sql</em></strong> file with following contents</p><pre>/* Replace with your SQL commands */ <br>DROP TABLE users;</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/710/0*GP9Qj-j8gOD_1DjE" /></figure><h4>Create a New Migration Script for Insert &amp; Remove User data:</h4><pre>db-migrate create add-users</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/841/0*q5GbQi2Qi30RThUW" /></figure><h3>Create Massive Fake data using Faker.js:</h3><p>Goto scripts folder, In <strong><em>generate-users.js</em></strong> file with following contents</p><p>Replace your *-add-users-up.sql file &lt;!- REPLACE YOUR SQL FILE NAME -&gt;.</p><pre>// generator.js<br>const fs = require(&#39;fs&#39;)<br>const faker = require(&#39;faker&#39;)<br>const argv = require(&#39;yargs&#39;).argv<br><br>const lines = argv.lines || 1000000<br>const filename = argv.output || &#39;&lt;!-- REPLACE YOUR SQL FILE NAME --&gt;&#39;<br>const writeStream = fs.createWriteStream(&#39;./migrations/sqls/&#39;+filename)<br><br>const createUser = () =&gt; {<br>    const title = faker.name.firstName().replace(/[^\w\s]/gi, &#39;&#39;);<br>    const balance = faker.random.number(10000)<br>    const email = faker.internet.email();<br>  <br>    return `(&#39;${title}&#39;,&#39;${email}&#39;,${balance});\n`<br>  }<br>  <br>  const startWriting = (writeStream, encoding, done) =&gt; {<br>  let i = lines<br>  function writing(){<br>    let canWrite = true<br>    do {<br>      i--<br>      let post = &#39;INSERT INTO users (`name`, `email`, `balance`) VALUES &#39; + createUser()<br>      //check if i === 0 so we would write and call `done`<br>      if(i === 0){<br>        // we are done so fire callback<br>        writeStream.write(post, encoding, done)<br>      }else{<br>        // we are not done so don&#39;t fire callback<br>        writeStream.write(post, encoding)<br>      }<br>      //else call write and continue looping<br>    } while(i &gt; 0 &amp;&amp; canWrite)<br>    if(i &gt; 0 &amp;&amp; !canWrite){<br>      //our buffer for stream filled and need to wait for drain<br>      // Write some more once it drains.<br>      writeStream.once(&#39;drain&#39;, writing);<br>    }<br>  }<br>  writing()<br>}<br><br>//write our `header` line before we invoke the loop<br>//writeStream.write(`\n`, &#39;utf-8&#39;)<br>//invoke startWriting and pass callback<br>startWriting(writeStream, &#39;utf-8&#39;, () =&gt; {<br>    writeStream.end()<br>})</pre><p>Run this file in the terminal</p><pre>node generate-users.js</pre><p>Then, random records added in *-add-users-up.sql file. You can check that file after executing command.</p><p>Finally, Run the migration command in the terminal.</p><p>You will see the result in the database.</p><pre>db-migrate up // for add and create tables <br>db-migrate down // for remove and truncate tables.</pre><p><em>Originally published at </em><a href="https://www.phpexpertise.com/how-to-generate-and-store-massive-data-in-node-js/"><em>https://www.phpexpertise.com</em></a><em> on January 1, 2021.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=1772d18d2050" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Sequelize Tutorial with Node.js]]></title>
            <link>https://medium.com/@phpxpertise/sequelize-tutorial-with-node-js-63f5d2f89094?source=rss-5fee6db85a97------2</link>
            <guid isPermaLink="false">https://medium.com/p/63f5d2f89094</guid>
            <category><![CDATA[expressjs]]></category>
            <category><![CDATA[mysql]]></category>
            <category><![CDATA[nodejs]]></category>
            <category><![CDATA[node]]></category>
            <category><![CDATA[sequelize]]></category>
            <dc:creator><![CDATA[PHPEXPERTISE]]></dc:creator>
            <pubDate>Tue, 04 Aug 2020 15:18:44 GMT</pubDate>
            <atom:updated>2020-08-04T16:31:49.163Z</atom:updated>
            <content:encoded><![CDATA[<p>In this tutorial explains about <strong><em>How to integrate Sequelize ORM in your application with node js.</em></strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/648/0*HlO5BgvonDPRR3cc" /></figure><h3>What is Sequelize</h3><p>Sequelize is a promise-based ORM for Node.js. It supports various databases like PostgreSQL, MySQL, MSSQL, and SQLite. This features are transaction support, relations and read replications.</p><h3>Install Sequelize</h3><p>We initialize a Node application and install Sequelize and MySQL adapter.</p><pre>$ node -v <br>$ npm init<br> // Using NPM <br>$ npm install --save sequelize</pre><p>Install one of the following database driver in your application.</p><pre>$ npm install --save pg pg-hstore<br>$ npm install --save mysql2<br>$ npm install --save sqlite3<br>$ npm install --save tedious // MSSQL</pre><h3>Setting up a connection</h3><p>After the installation steps, create an connection with following contents. Here we can create an connection in two ways.</p><p>First method, we can customize the connection pool in <strong><em>models/db.js</em></strong>.</p><pre>const Sequelize = require(&#39;sequelize&#39;);<br>const sequelize = new Sequelize(&#39;database&#39;, &#39;username&#39;, &#39;password&#39;, {<br>  host: &#39;localhost&#39;,<br>  dialect: &#39;mysql&#39;, //|&#39;sqlite&#39;|&#39;postgres&#39;|&#39;mssql&#39;<br>  operatorsAliases: false,<br><br>  pool: {<br>    max: 5,<br>    min: 0,<br>    acquire: 30000,<br>    idle: 10000<br>  },<br><br>  // SQLite only<br>  storage: &#39;path/to/database.sqlite&#39;<br>});</pre><p>Second one you can simply use a connection uri in <strong><em>models/db.js</em></strong></p><pre>const Sequelize = require(&#39;sequelize&#39;);<br>const sequelize = new Sequelize(&#39;mysql://user:pass@localhost:3306/dbname&#39;);</pre><p>You can use the .authenticate() function like this to test the connection.</p><pre>sequelize<br>  .authenticate()<br>  .then(() =&gt; {<br>    console.log(&#39;Connection has been established successfully.&#39;);<br>  })<br>  .catch(err =&gt; {<br>    console.error(&#39;Unable to connect to the database:&#39;, err);<br>  });Added above code at the end of the <strong><em>models/db.js</em></strong> file.</pre><h3>Create a Model</h3><p>Models are defined with following contents in <strong><em>models/user.model.js</em></strong></p><pre>const { Sequelize, DataTypes } = require(&#39;sequelize&#39;);<br>module.exports = (Sequelize, DataTypes) =&gt; {<br>const User = Sequelize.define(&#39;user&#39;, {<br>  id: {<br>        type: DataTypes.INTEGER,<br>        primaryKey: true,<br>        autoIncrement: true<br>      },<br>  name: {<br>    type: DataTypes.STRING<br>  },<br>  email: {<br>    type: DataTypes.STRING<br>  },<br> password: {<br>    type: DataTypes.STRING<br>  }<br>});<br>return User;<br>}</pre><blockquote><em>force: true will drop the table if it already exists. This method is recommended for development mode.</em></blockquote><pre>User.sync({force: true}).then(() =&gt; {<br>  // Table created<br>  return User.create({<br>    name: &#39;John&#39;,<br>    email: &#39;john123@example.com&#39;,<br>    password: &#39;123456&#39;<br>  });<br>});</pre><h3>How to write a query</h3><p>This helps you how to make the standard <a href="https://en.wikipedia.org/wiki/Create,_read,_update_and_delete">CRUD</a> queries.</p><h4>Simple INSERT Query</h4><pre>// Create a new user<br>const user = await User.create({ name: &quot;John&quot;, email: &quot;John123@exmaple.com&quot;, password: &quot;12346&quot; });<br>console.log(&quot;PK ID:&quot;, user.id);</pre><h4>Simple SELECT queries</h4><pre>// Find all users<br>const users = await User.findAll();<br>console.log(&quot;All users:&quot;, JSON.stringify(users, null, 2));</pre><h4>Simple UPDATE queries</h4><pre>await User.destroy({<br>  where: {<br>    email: &#39;John123@example.com&#39;<br>  }<br>});</pre><h4>Simple DELETE queries</h4><pre>await User.destroy({<br>  truncate: true<br>});</pre><p>Use below code for <strong><em>Truncate</em></strong> the table.</p><pre>await User.destroy({ truncate: true });</pre><p><em>Originally published at </em><a href="https://www.phpexpertise.com/sequelize-orm-tutorial-with-node-js-and-express/"><em>https://www.phpexpertise.com</em></a><em> on August 4, 2020.</em></p><p>Read article at <a href="https://www.phpexpertise.com/sequelize-orm-tutorial-with-node-js-and-express/">https://www.phpexpertise.com/sequelize-orm-tutorial-with-node-js-and-express/</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=63f5d2f89094" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[How to Setup Web Push Notification to Your WordPress Site]]></title>
            <link>https://medium.com/@phpxpertise/how-to-setup-web-push-notification-to-your-wordpress-site-b393b3ac742d?source=rss-5fee6db85a97------2</link>
            <guid isPermaLink="false">https://medium.com/p/b393b3ac742d</guid>
            <category><![CDATA[wordpress-plugins]]></category>
            <category><![CDATA[php-expertise]]></category>
            <category><![CDATA[onesignal]]></category>
            <category><![CDATA[wordpress]]></category>
            <category><![CDATA[wordpress-web-development]]></category>
            <dc:creator><![CDATA[PHPEXPERTISE]]></dc:creator>
            <pubDate>Mon, 20 Jul 2020 14:30:51 GMT</pubDate>
            <atom:updated>2020-07-20T14:48:37.623Z</atom:updated>
            <content:encoded><![CDATA[<p>In this tutorial we explains about <strong><em>How to Add Web Push Notification to Your Site</em></strong>. Push notification allows you to send notification to users even they are not visiting your website. In WordPress many push notification plugins are available. Here we will see about how to send notification to desktop and mobile push notifications from your WordPress site.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/652/0*1VnkluP7dtEb1_Ud.png" /></figure><h3>What is Push Notification</h3><p>Push notification is helps to increase your website traffic. Normally clickable messages are displayed on your desktop and mobile device. When these message are shown that user browser is not open.</p><h3>What is OneSignal Plugin</h3><p>OneSignal is a popular push notification service provider for both web and mobile. This plugin is easy to install in WordPress site. First we have to create an account in <a href="https://app.onesignal.com/signup">OneSignal</a> platform.</p><h3>Create an App in OneSignal</h3><p>Once you created account in OneSignal. Please do the following ways to create an application for connecting your WordPress site.</p><p><strong>Step 1:</strong> Create an app or website in OneSignal.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/566/0*61Lil864ZoPGZugx.png" /></figure><p><strong>Step 2:</strong> To configure web push and choose integration mode</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*Ub9WA_0EJ6_7D5nF.png" /></figure><p><strong>Step 3:</strong> We choose integration in WordPress Plugin &gt; Select WordPress logo in the below</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*-fPvIxmJOb-KMRMq.png" /></figure><p><strong>Step 4:</strong> Copy the APP ID and API KEY</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/723/0*vG2c1ISxwz6wstbd.png" /></figure><p><strong>Step 5:</strong> Your Application is ready on OneSignal.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/908/0*JbLq4PsLU_2DHLIa.png" /></figure><p><strong>Step 6:</strong> Go to your WordPress site and Plugins &gt; Add New</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/551/0*lDUrHlxKk5oOZ9St.png" /></figure><p><strong>Step 7:</strong> After the installation Activate it and Open Configuration tab paste your APP ID and REST API Key i.e Step 4.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/807/0*dnTqX4v6APK2yUk9.png" /></figure><p><strong>Step 8:</strong> WordPress Site &gt; OneSignal Push (from left menu) &gt; Click Configuration Tab</p><p>In this section following settings are available in this tab. So that you can easily customize the settings as our needs.</p><p><strong><em>Account Settings</em></strong> <strong><em>Sent Notification Settings</em></strong> <strong><em>Prompt Settings &amp; Subscription Bell</em></strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/743/0*O1mYv6GisKYP3pTf.png" /></figure><p><strong><em>Prompt Customization</em></strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/514/0*NRb0zBcAxuUmzpSM.png" /></figure><p><strong><em>Welcome Notification Settings</em></strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/406/0*1oAt7O2kfPUFdCdG.png" /></figure><p><strong><em>Automatic Notification Settings</em></strong> <strong><em>Advanced Settings</em></strong></p><p>Article link available in <a href="https://www.phpexpertise.com/how-to-setup-web-push-notification-to-your-site/">here</a>.</p><p>For more technical articles please visit <a href="https://www.phpexpertise.com/">phpexpertise</a> webiste</p><p><em>Originally published at </em><a href="https://www.phpexpertise.com/how-to-setup-web-push-notification-to-your-site/"><em>https://www.phpexpertise.com</em></a><em> on July 20, 2020.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=b393b3ac742d" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[How to build Secure Authentication App using JWT in Node.JS]]></title>
            <link>https://medium.com/@phpxpertise/how-to-build-secure-authentication-app-using-jwt-in-node-js-2dd2b7ebaa00?source=rss-5fee6db85a97------2</link>
            <guid isPermaLink="false">https://medium.com/p/2dd2b7ebaa00</guid>
            <category><![CDATA[expressjs]]></category>
            <category><![CDATA[mongodb]]></category>
            <category><![CDATA[nodejs]]></category>
            <category><![CDATA[node-js-tutorial]]></category>
            <category><![CDATA[php-expertise]]></category>
            <dc:creator><![CDATA[PHPEXPERTISE]]></dc:creator>
            <pubDate>Tue, 23 Jun 2020 06:52:15 GMT</pubDate>
            <atom:updated>2020-06-23T14:42:28.801Z</atom:updated>
            <content:encoded><![CDATA[<p>In this tutorial, we are going to discuss about <strong>How to build Secure Authentication App using JWT in Node.JS and Express JS. </strong>JWT means JSON Web Token is a object that is safe approach to transfer data between two parties.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/652/0*lbrk2NMrOGNJ20ZE.png" /></figure><h3>Authentication Workflow with JWT</h3><ol><li>When server receives a request from user end and JWT will encrypted that information and associate with <strong><em>JWT token.</em></strong></li><li>Client store the token in their machine for accessing data next time.</li><li>Next request, client sets token in header using Authorization with <strong><em>Bearer XXXX XXXX XXXX</em></strong></li><li>In server, verify that token once succeeded and returns the result. If that mismatch returns the message with <strong><em>Authorization failed.</em></strong></li></ol><h3>Prerequisites</h3><ol><li><a href="https://www.npmjs.com/package/express">Express</a> — is a popular framework which is a most common framework used in node.js</li><li><a href="https://www.npmjs.com/package/jsonwebtoken">JSON Web Token(JWT)</a> — It is used to generating token for only authorized persons can able to access the application</li><li><a href="https://www.npmjs.com/package/bcryptjs">Bcrypt</a> — It is used to hash the password into the protected string before saving it to the database.</li><li><a href="https://www.npmjs.com/package/body-parser">Body-parser</a> — It is used to parse the JSON data, plain text or a whole object.</li><li><a href="https://www.npmjs.com/package/cors">CORS</a> — It allows enabling CORS with multiple options. It is available through the npm registry.</li><li><a href="https://www.npmjs.com/package/mongoose">Mongoose</a> — It allows you to interact with MongoDB database.</li><li><a href="https://www.npmjs.com/package/env-cmd">ENV</a> — It allows you to create environment file for keeping configuration variables accessing at any where.</li><li><a href="https://www.npmjs.com/package/validator">Validator</a> — It helps to validate the user inputs with mongoose.</li><li><a href="https://www.postman.com/downloads/">Postman</a> — for testing API.</li></ol><h3>Install Packages</h3><pre>npm init <br>npm install express jsonwebtoken bcryptjs body-parser cors mongoose env-cmd --save <br>npm install nodemon --save-dev</pre><p>After the installation and create following files and folders in your project directory.</p><pre>touch app.js<br><br>// Root Directory<br>mkdir middleware<br>mkdir models<br>mkdir routes<br>// Authnetication<br>cd middleware<br>touch auth.js<br>// Database<br>cd models<br>touch db.js<br>touch user.model.js<br>//Routing<br>cd routes<br>touch user.route.js</pre><h3>Project Setup</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/362/0*fxxtTpJrdv5KmC7Z.png" /></figure><h3>Setup ENV variables</h3><p>Create a file inside directory with following contents</p><pre>PORT=4000 <br>JWT_KEY=JwtAuthenticationApp2020 MONGODB_URI=mongodb://localhost:27017/bg_mongo</pre><h3>Define Mongoose Schema</h3><p>Before create a schema we have to make an connection with mongodb in <strong><em>/models/db.js</em></strong> file with following contents.</p><pre>// MongoDB connection const mongoose = require(&#39;mongoose&#39;); mongoose.Promise = global.Promise; mongoose.connect(process.env.MONGODB_URI, {useUnifiedTopology: true, useNewUrlParser: true, useCreateIndex: true}); <br>const db = mongoose.connection; <br>db.on(&#39;error&#39;, console.error.bind(console, &#39;MongoDB connection error&#39;));</pre><p>Create schema for users table in <strong><em>/models/user.model.js</em></strong> file with following contents</p><pre>const mongoose = require(&#39;mongoose&#39;);<br>const validator = require(&#39;validator&#39;);<br><br>const Schema = mongoose.Schema;<br><br>const userSchema = new Schema({<br>    name: {<br>        type: String,<br>        required: true,<br>        trim: true,<br>        max: 65<br>    },<br>    email: {<br>        type: String,<br>        required: true,<br>        trim: true,<br>        unique: true,<br>        lowercase: true,<br>        max: 65,<br>        validator: value =&gt; {<br>            if (!validator.isEmail(value)) {<br>                throw new Error({ error: &#39;Invalid Email address&#39;  });<br>            }<br>        }<br>    },<br>    password: {<br>        type: String,<br>        required: true,<br>        trim: true,<br>        minlength: 8<br>    }<br>});<br><br>module.exports = mongoose.model(&#39;User&#39;, userSchema);</pre><p>In <strong><em>app.js</em></strong> file with following contents</p><pre>const express = require(&#39;express&#39;);<br>const bodyParser = require(&#39;body-parser&#39;);<br>const cors = require(&quot;cors&quot;);<br>const router = require(&#39;./routes/user.route&#39;);<br><br>require(&#39;dotenv&#39;).config();<br>require(&#39;./models/db&#39;);<br>const port = process.env.PORT;<br>const app = express();<br><br>var corsOptions = {<br>    origin: &quot;http://localhost:4000&quot;<br>};<br>  <br>app.use(cors(corsOptions));<br>app.use(bodyParser.json());<br>app.use(bodyParser.urlencoded({extended:false}));<br>app.use(&#39;/&#39;, router);<br><br>app.listen(port, () =&gt; {<br>    console.log(`Server running on port ${port}`)<br>})</pre><p>In <strong><em>/routes/user.route.js</em></strong> file with following contents</p><pre>const router = require(&#39;express&#39;).Router();<br>const bcrypt = require(&#39;bcryptjs&#39;);<br>const jwt = require(&#39;jsonwebtoken&#39;);<br>const userModel = require(&#39;../models/user.model&#39;);<br>const auth = require(&#39;../middleware/auth&#39;);</pre><p>Once included the packages, we makes below REST API calls.</p><p><strong><em>HTTP /POST — user register</em></strong></p><pre>router.post(&#39;/user/register&#39;, (req, res, next) =&gt; {<br>    bcrypt.hash(req.body.password, 10).then((hash) =&gt; {<br>        const user = new userModel({<br>            name: req.body.name,<br>            email: req.body.email,<br>            password: hash<br>        });<br><br>        user.save().then((response) =&gt; {<br>            res.status(201).json({message: &quot;User successfully created!&quot;, result: response});<br>        }).catch(error =&gt; {<br>            res.status(500).json({error: error});<br>        })<br>    });<br>});</pre><p>After that, Run <strong><em>nodemon app.js </em></strong>in the terminal. Goto Postman check register URL <a href="http://localhost:4000/user/register"><strong><em>http://localhost:4000/user/register</em></strong></a><strong><em> </em></strong>through /POST method.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/908/0*c4EmtQvNjMKHmMSw.png" /></figure><p><strong><em>HTTP /POST — user login</em></strong></p><pre>router.post(&#39;/user/login&#39;, (req, res, next) =&gt; {<br>    let getUser;<br>    userModel.findOne({ <br>        email: req.body.email <br>    }).then(user =&gt; {<br>        if (!user) {<br>            return res.status(401).json({message: &quot;Authentication failed&quot;});<br>        }<br>        getUser = user;<br>        return bcrypt.compare(req.body.password, user.password);<br>    }).then(response =&gt; {<br>        if (!response) {<br>            return res.status(401).json({message: &quot;Authentication failed&quot;});<br>        }<br>        let jwtToken = jwt.sign(<br>            {<br>                email: getUser.email,userId: getUser._id,<br>            }, <br>            process.env.JWT_KEY, <br>            {<br>                expiresIn: &quot;1h&quot;<br>            }<br>        );<br>        res.status(200).json({<br>            token: jwtToken,<br>            expiresIn: 3600,<br>            data: getUser<br>        });<br>    }).catch(error =&gt; {<br>        return res.status(401).json({message: &quot;Authentication failed&quot;});<br>    })<br>});</pre><p>After that, Run <strong><em>nodemon app.js </em></strong>in the terminal. Goto Postman check login URL <a href="http://localhost:4000/user/login"><strong><em>http://localhost:4000/user/login</em></strong></a><strong><em> </em></strong>through /POST method.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/993/0*Zd8szKvUlNkErjaX.png" /></figure><p>After logged we make an API for profile page.</p><p>Before making this API we need to create authentication function to verify that connection using in <strong><em>/middleware/auth.js</em></strong> file with following contents</p><pre>const jwt = require(&#39;jsonwebtoken&#39;);<br>const userModel = require(&#39;../models/user.model&#39;);<br><br>const auth = (req, res, next) =&gt; {<br>    const authHeader = req.headers.authorization;<br>    if (authHeader) {<br>        const token = authHeader.split(&#39; &#39;)[1];<br>        data = jwt.verify(token, process.env.JWT_KEY);<br>    <br>        userModel.findOne({<br>            _id: data.userId,<br>        }).then(user =&gt; {<br>            if (!user) {<br>                res.status(401).json({message: &quot;Authentication failed&quot;});<br>            }<br>            next();<br>        }).catch(error =&gt; {<br>            return res.status(401).json({message: &quot;Authentication failed&quot;});<br>        });<br>    } else {<br>        return res.status(401).json({message: &quot;Authentication missing&quot;});<br>    }<br>};<br><br>module.exports = auth;</pre><p>Update the below codes in <strong><em>/routes/user.route.js</em></strong> file for user profile page.</p><pre>router.get(&#39;/user/me/:id&#39;, auth, (req, res, next) =&gt; {<br>    userModel.findById(req.params.id, (error, data) =&gt; {<br>        if (error) {<br>            return next(error);<br>        } else {<br>            res.status(200).json({result: data});<br>        }<br>    });<br>});</pre><p>After that, Run <strong><em>nodemon app.js </em></strong>in the terminal. Goto Postman check this profile URL <a href="http://localhost:4000/user/me/%7B_id%7D"><strong><em>http://localhost:4000/user/me/{_id}</em></strong></a><strong><em> </em></strong>through /GET method.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/900/0*IhOBn7w0Ye1QCKjO.png" /></figure><p>Thanks for reading this tutorial. Please share this post with others.</p><h4>Read more Node.JS Articles</h4><p>Please visit at <a href="https://www.phpexpertise.com/">PHPEXPERTISE</a> —It’s a Technical Blog.</p><p><em>Originally published at </em><a href="https://www.phpexpertise.com/authentication-app-using-jwt-in-node-js/"><em>https://www.phpexpertise.com</em></a><em> on June 23, 2020.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=2dd2b7ebaa00" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[How to Integrate File Upload using Multer with Node.js and Express JS]]></title>
            <link>https://medium.com/@phpxpertise/how-to-integrate-file-upload-using-multer-with-node-js-and-express-js-12443c82e84b?source=rss-5fee6db85a97------2</link>
            <guid isPermaLink="false">https://medium.com/p/12443c82e84b</guid>
            <category><![CDATA[php-expertise]]></category>
            <category><![CDATA[multer]]></category>
            <category><![CDATA[nodejs]]></category>
            <category><![CDATA[node-js-tutorial]]></category>
            <category><![CDATA[expressjs]]></category>
            <dc:creator><![CDATA[PHPEXPERTISE]]></dc:creator>
            <pubDate>Thu, 18 Jun 2020 04:12:16 GMT</pubDate>
            <atom:updated>2020-06-18T04:44:17.970Z</atom:updated>
            <content:encoded><![CDATA[<p>In this tutorial, we discuss about <strong>How to Integrate File Upload using Multer with Node.js and Express JS. </strong>File upload is a very common operation in any application. In node.js adding a file upload feature using package to add a file very easy to app. Here we are going to see file upload operation in two ways.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/652/0*2z45jJ8DULR60Dod.png" /></figure><h3>Uploading a File through:</h3><ol><li>Postman</li><li>HTML Form (Template Engine)</li></ol><p>First, we see the file upload with Multer in Node.js and Express JS using Postman.</p><h3>Prerequisites:</h3><ol><li><a href="https://www.npmjs.com/package/express">Express</a> — is a popular framework which is a most common framework used in node.js</li><li><a href="https://www.npmjs.com/package/multer">Multer</a> — It is a middleware for handling multipart/form-data, which is primarily used for uploading files.</li><li><a href="https://www.postman.com/downloads/">Postman</a> — for testing API.</li><li><a href="https://www.npmjs.com/package/ejs">Embedded Javascript Template</a> — used to implement HTML tags elements such as forms, layouts etc.</li></ol><h3>Install the Packages:</h3><pre>npm install express --save <br>npm install path --save <br>npm install multer --save</pre><h3>Project Setup</h3><p>Your project setup look like this</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/653/0*VABYp3cJSdphbA1b.png" /></figure><p>In <strong><em>app.js</em></strong>file create a server with following contents</p><pre>// load express<br>const express = require(&#39;express&#39;);<br>const app = express();<br>app.get(&#39;/&#39;, (req, res) =&gt; {  <br>   res.send(&#39;hello world&#39;);<br>});<br>app.listen(3000, () =&gt; { <br>    console.log(&#39;Started on port 3000&#39;);<br>});</pre><p>Now run the file using the below command in the terminal.</p><pre>node app.js</pre><p>After this, You can get the server URL <a href="http://localhost:4000/"><strong><em>http://localhost:4000/</em></strong></a><strong><em> </em></strong>Open the browser and check that URL.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/897/0*ZT6SO0Pl1a7Y7W1d.png" /></figure><h3>Adding Multer</h3><p>Adding multer package in <strong><em>app.js</em></strong><em> </em>using require() method.</p><pre>const multer = require(&#39;multer&#39;); <br>const upload = multer({dest:&#39;uploads/&#39;}).single(&quot;file_image&quot;);</pre><p>In the above code <strong><em>dest</em> </strong>option used to store the file in the specified directory. If you omit this file doesn’t written in the disk.</p><h3>DiskStorage</h3><p>The disk storage engine gives you full control over storing files to disk. We will create a storage object using the <strong><em>diskStorage</em></strong>() method.</p><p>The following code will go in <strong><em>app.js</em></strong></p><pre>var storage = multer.diskStorage({ <br>            destination: function (req, file, cb) { <br>            <br>                // Uploads is the Upload_folder_name <br>                cb(null, &quot;uploads&quot;) <br>            }, <br>            filename: function (req, file, cb) { <br>                cb(null, file.fieldname + &quot;-&quot; + Date.now()+ path.extname(file.originalname)) <br>            } <br>        });</pre><p>Here, there are two properties, <strong><em>destination</em></strong>, and . They both are functions.</p><p><strong>destination: </strong>used to allows you to which directory you want to store the uploaded files.</p><p><strong>filename: </strong>used to determine what the file should be named inside the folder.</p><p><strong>null: </strong>Don’t want to show any error.</p><h3>Multer Upload Options</h3><ol><li><strong>limits</strong> — You can also put a limit on the size of the file that is being uploaded with the help of using <em>limits.</em></li><li><strong>fileFilter<em> — </em></strong>Set this to a function to control which files should be uploaded and which should be skipped.</li></ol><pre>const maxSize = 1 * 1000 * 1000; // max 1 MB<br><br>var upload = multer({  <br>            storage: storage, <br>            limits: { fileSize: maxSize }, <br>            fileFilter: function (req, file, cb){ <br>            <br>                // Set the filetypes, it is optional <br>                var filetypes = /jpeg|jpg|png/; <br>                var mimetype = filetypes.test(file.mimetype); <br>          <br>                var extname = filetypes.test(path.extname(file.originalname).toLowerCase()); <br>                <br>                if (mimetype &amp;&amp; extname) { <br>                    return cb(null, true); <br>                } <br>              <br>                cb(&quot;Error: File upload only supports the &quot; + &quot;following filetypes - &quot; + filetypes); <br>              }  <br>          <br>        // file_image is the name of file attribute <br>        }).single(&quot;file_image&quot;);</pre><p>The following code will go in <strong><em>app.js:</em></strong></p><pre>app.post(&quot;/imageUpload&quot;, (req, res) =&gt; {<br>   upload(req, res, (err) =&gt; {<br>    if(err) {<br>      res.status(400).send(&quot;Something went wrong!&quot;);<br>    }<br>    res.send(req.file);<br>  });<br>});</pre><p>Run the file and check this URL <a href="http://localhost:4000/imageUpload"><strong><em>http://localhost:4000/imageUpload</em></strong></a><strong><em> </em></strong>in Postman.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/905/0*SB2OvJ9HTI7qNy7I.png" /></figure><h3>File Upload Using HTML Form</h3><p>You need to install <strong><em>ejs</em></strong> package that helps to integrate form in node.js.</p><pre>npm install ejs --save</pre><p>Update the following code in <strong><em>app.js</em></strong></p><pre>app.engine(&#39;html&#39;, require(&#39;ejs&#39;).renderFile);<br>app.set(&#39;view engine&#39;, &#39;ejs&#39;); app.set(&#39;views&#39;,path.join(__dirname,&#39;views&#39;));</pre><p>Created <strong><em>views </em></strong>directory for html related files such as forms, layouts are inside this folder.</p><pre>mkdir views <br>cd views <br>touch fileupload.ejs</pre><p>In <strong><em>fileupload.ejs </em></strong>file inside . <strong>views/</strong> directory with following contents</p><pre>&lt;!DOCTYPE html&gt; <br>&lt;html&gt; <br>&lt;head&gt; <br>    &lt;title&gt;FILE UPLOAD DEMO&lt;/title&gt; <br>&lt;/head&gt; <br> &lt;body&gt; <br>    &lt;h1&gt;File Upload Demo&lt;/h1&gt; <br><br>    &lt;form action=&quot;/imageUpload&quot; <br>      enctype=&quot;multipart/form-data&quot; method=&quot;POST&quot;&gt; <br>      <br>        &lt;span&gt;Upload Profile Picture:&lt;/span&gt;   <br>        &lt;input type=&quot;file&quot; name=&quot;file_image&quot; required/&gt; &lt;br&gt; <br>        &lt;input type=&quot;submit&quot; value=&quot;submit&quot;&gt;  <br>    &lt;/form&gt; <br>&lt;/body&gt; <br>&lt;/html&gt;</pre><p>In <strong><em>app.js </em></strong>file update the following contents</p><pre>app.get(&#39;/&#39;, function(req, res) {<br>    res.render(&#39;fileupload&#39;);<br>});</pre><p>To run file in the terminal <a href="http://localhost:4000/"><strong><em>http://localhost:4000/</em></strong></a></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/844/0*hTxmvbG-bYwff2gb.png" /></figure><p>Finally <strong><em>app.js </em></strong>file integrated with all codes</p><pre>// load express<br>const express = require(&#39;express&#39;);<br>const multer = require(&#39;multer&#39;);<br>const path = require(&#39;path&#39;);<br>const app = express();<br><br>// ejs for html template<br>app.engine(&#39;html&#39;, require(&#39;ejs&#39;).renderFile);<br>app.set(&#39;view engine&#39;, &#39;ejs&#39;);<br>app.set(&#39;views&#39;,path.join(__dirname,&#39;views&#39;));<br><br>// Disk storage<br>var storage = multer.diskStorage({ <br>    destination: function (req, file, cb) { <br>    <br>        // Uploads is the Upload_folder_name <br>        cb(null, &quot;uploads&quot;) <br>    }, <br>    filename: function (req, file, cb) { <br>        cb(null, file.fieldname + &quot;-&quot; + Date.now()+ path.extname(file.originalname)) <br>    } <br>});<br><br>// multer upload options<br>const maxSize = 1 * 1000 * 1000; // max 1 MB<br>var upload = multer({  <br>            storage: storage, <br>            limits: { fileSize: maxSize }, <br>            fileFilter: function (req, file, cb){ <br>            <br>                // Set the filetypes, it is optional <br>                var filetypes = /jpeg|jpg|png/; <br>                var mimetype = filetypes.test(file.mimetype); <br>          <br>                var extname = filetypes.test(path.extname(file.originalname).toLowerCase()); <br>                <br>                if (mimetype &amp;&amp; extname) { <br>                    return cb(null, true); <br>                } <br>              <br>                cb(&quot;Error: File upload only supports the &quot; + &quot;following filetypes - &quot; + filetypes); <br>              }  <br>          <br>        // file_image is the name of file attribute <br>        }).single(&quot;file_image&quot;);  <br><br>// routing for home page<br>app.get(&#39;/&#39;, function(req, res) {<br>    res.render(&#39;fileupload&#39;);<br>});<br><br>// routing for file upload<br>app.post(&quot;/imageUpload&quot;, (req, res) =&gt; {<br>    upload(req, res, (err) =&gt; {<br>        if(err) {<br>            res.status(400).send(&quot;Something went wrong!&quot;);<br>        }<br>            res.send(req.file);<br>    });<br>});<br><br>// create server<br>app.listen(4000, () =&gt; { <br>    console.log(&#39;Started on port 4000&#39;);<br>});</pre><p><a href="https://www.phpexpertise.com/restful-api-using-nodejs/">Building a Restful CRUD API with Node.js Express and MongoDB</a></p><p><a href="https://www.phpexpertise.com/node-js-express-security-best-practices/">How to Make Your App Save and Secure from Security Issues</a></p><h3>Comments</h3><p>comments</p><p><em>Originally published at </em><a href="https://www.phpexpertise.com/file-upload-using-multer-with-node-js-and-express-js/"><em>https://www.phpexpertise.com</em></a><em> on June 18, 2020.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=12443c82e84b" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Free SSL Certificate for GoDaddy using CloudFlare]]></title>
            <link>https://medium.com/@phpxpertise/free-ssl-certificate-for-godaddy-using-cloudflare-b9d8e286ff20?source=rss-5fee6db85a97------2</link>
            <guid isPermaLink="false">https://medium.com/p/b9d8e286ff20</guid>
            <category><![CDATA[cloudflare]]></category>
            <category><![CDATA[free-ssl-certificate]]></category>
            <category><![CDATA[godaddy]]></category>
            <category><![CDATA[php-expertise]]></category>
            <dc:creator><![CDATA[PHPEXPERTISE]]></dc:creator>
            <pubDate>Mon, 18 May 2020 14:18:13 GMT</pubDate>
            <atom:updated>2020-05-18T14:31:48.626Z</atom:updated>
            <content:encoded><![CDATA[<p><strong>HTTPS</strong> is the secured version of HTTP. HTTP is the protocol used by your browser and web servers to communicate and exchange information. /TLS. When that exchange of data is encrypted with <strong>SSL</strong>/TLS, then we call it <strong>HTTPS</strong>. The ‘S’ stands for Secure.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/652/0*_dVVmwfguDE2pFyK.png" /></figure><p><strong>Cloudflare</strong> provides free SSL certificate with limited access which is enough for blogger or any website.</p><h3>Activate Free SSL for GoDaddy:</h3><p>Below are the steps to configure SSL certificate of Cloudflare.</p><p><strong>Step 1:</strong> Go to <a href="https://cloudflare.com/">cloudflare.com</a> and create a free plan account.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/492/0*uSncq6rBhv0sk8Hu.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/962/0*JKTocbC57ZO9wp9K.png" /></figure><p>2. Select a free plan.</p><p><strong>Step 2:</strong> cloudflare gets your domain record information and new nameservers with the following content:</p><p><strong>Step 3:</strong> Go to GoDaddy hosting account <a href="https://www.godaddy.com/">here</a>.</p><blockquote><em>Note: Take backup of your CNAME,TXT, and Domain record settings. Because if you’re using third party nameservers, GoDaddy never maintain the DNS records.</em></blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*AVwB6vCieIV7p_ZW.png" /></figure><p>After updated new nameservers<strong>, Cloudflare </strong>takes the CNAME,TXT information from GoDaddy and You can see the details in <strong><em>DNS</em></strong> page.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*fr57toAcxZdHEVXy.png" /></figure><p><strong>Step 4: </strong>Activate your free SSL certificates (https). Enable <strong>Always Use HTTPs</strong> turn on.</p><p>Page scroll down, By default enabled <strong>Automatic HTTPs Rewrites </strong>is set to on.</p><p><strong>Step 5: </strong>If you’re a wordpress user, go to <strong>Page Rules </strong>and following page rules. This will helpful to redirect existing pages to HTTPs.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*Tt-3wBLw5LBBcUP_.png" /></figure><p>In free plan, they allowed 3 pages only. If you want to more pages you have to buy the premium plan.</p><blockquote><strong><em>Note: </em></strong><em>Above steps are used to configure Free SSL(HTTPs) for your domain in Cloudflare,</em></blockquote><blockquote><em>Hereafter, the following steps for wordpress user only.</em></blockquote><h3>WordPress Users Do below steps:</h3><ol><li>Menu &gt; Plugins &gt; Add New</li><li>Install <strong>Really Simple SSL </strong>plugins</li><li>After installed, Menu &gt; Settings &gt; SSL and See your SSL status.</li><li>Go to menu &gt; Settings &gt; General</li><li>Update the <strong>WordPress Address Url</strong> and <strong>Site url </strong>(http into https)</li><li>Update <em>.htaccess </em>file for allowing http to https redirect.</li></ol><p><strong>Step 6:</strong> Go to your site admin login. Once you’ve logged please update the following content:</p><p>Add your website in <a href="https://www.google.com/webmasters/">Google Webmaster Tools</a> for Google search indexing.</p><h3>Comments</h3><p>comments</p><p><em>Originally published at </em><a href="https://www.phpexpertise.com/free-ssl-certificate-for-godaddy/"><em>https://www.phpexpertise.com</em></a><em> on May 18, 2020.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=b9d8e286ff20" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[5 Easy Steps to Enable SSH with Godaddy Linux Hosting Account]]></title>
            <link>https://medium.com/@phpxpertise/5-easy-steps-to-enable-ssh-with-godaddy-linux-hosting-account-7cfe0dae3051?source=rss-5fee6db85a97------2</link>
            <guid isPermaLink="false">https://medium.com/p/7cfe0dae3051</guid>
            <category><![CDATA[linux]]></category>
            <category><![CDATA[godaddy]]></category>
            <category><![CDATA[hosting]]></category>
            <category><![CDATA[terminal]]></category>
            <category><![CDATA[ssh]]></category>
            <dc:creator><![CDATA[PHPEXPERTISE]]></dc:creator>
            <pubDate>Sun, 17 May 2020 13:47:39 GMT</pubDate>
            <atom:updated>2020-05-17T14:06:23.904Z</atom:updated>
            <content:encoded><![CDATA[<p>SSH is a secure method of connecting to your hosting account to move all the files and execute commands through the terminal. Follow these 5 simple steps to enable SSH for your godaddy hosting account.</p><p>Go to your GoDaddy <a href="https://account.godaddy.com/products">product page</a>.</p><p>Scroll down, you will see web hosting section, click <strong>Manage</strong> button.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*SV0oNpB3rLvZYBpB.png" /></figure><p>In the account <strong>Dashboard, </strong>under <strong>Settings </strong>click <strong>Server.</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/357/0*E2GFz94Nw1unIx8I.png" /></figure><p>After click server button, this tab will looks like</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/362/0*lKen1eT-C8tavezq.png" /></figure><p>Click manage button, popup will shown in the page. You can turn <strong>on/off </strong>SSH access</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/724/0*b-rzyp7Lf3kHYKJt.png" /></figure><p>SSH will be turn on, Open your terminal with the following content:</p><pre>ssh {cpanel-username}@yourDomainName.com</pre><p>Enter the above command with your cpanel password.</p><p>Now, you will access your hosting from terminal.</p><p>Read more article at <a href="http://www.phpexpertise.com/"><strong>phpexpertise.com</strong></a></p><h3>Comments</h3><p>comments</p><p><em>Originally published at </em><a href="http://www.phpexpertise.com/enable-ssh-with-godaddy-hosting-account/"><em>http://www.phpexpertise.com</em></a><em> on May 17, 2020.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=7cfe0dae3051" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>