<?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 Perminder Klair on Medium]]></title>
        <description><![CDATA[Stories by Perminder Klair on Medium]]></description>
        <link>https://medium.com/@pinku1?source=rss-47712d2d10a8------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*DlQNHf374HTn-EugGNbi7g.jpeg</url>
            <title>Stories by Perminder Klair on Medium</title>
            <link>https://medium.com/@pinku1?source=rss-47712d2d10a8------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Mon, 30 Nov 2026 10:26:00 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@pinku1/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[Welcome to Zeiq]]></title>
            <link>https://medium.com/zeiq/welcome-to-zeiq-d828721a2003?source=rss-47712d2d10a8------2</link>
            <guid isPermaLink="false">https://medium.com/p/d828721a2003</guid>
            <dc:creator><![CDATA[Perminder Klair]]></dc:creator>
            <pubDate>Tue, 26 Jun 2018 07:35:51 GMT</pubDate>
            <atom:updated>2018-06-26T10:10:44.366Z</atom:updated>
            <content:encoded><![CDATA[<p>This is our first post, welcome!</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*lpsaorG8rIYgCgjAe15Zrw.jpeg" /></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=d828721a2003" width="1" height="1" alt=""><hr><p><a href="https://medium.com/zeiq/welcome-to-zeiq-d828721a2003">Welcome to Zeiq</a> was originally published in <a href="https://medium.com/zeiq">Zeiq</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Creating Static E-commerce site with GatsbyJs]]></title>
            <link>https://medium.com/zeiq/creating-static-e-commerce-site-with-gatsbyjs-a349d7e022a?source=rss-47712d2d10a8------2</link>
            <guid isPermaLink="false">https://medium.com/p/a349d7e022a</guid>
            <category><![CDATA[gatsbyjs]]></category>
            <category><![CDATA[e-commerce-software]]></category>
            <category><![CDATA[static-site]]></category>
            <category><![CDATA[contentful]]></category>
            <category><![CDATA[web-development]]></category>
            <dc:creator><![CDATA[Perminder Klair]]></dc:creator>
            <pubDate>Sun, 10 Jun 2018 09:45:33 GMT</pubDate>
            <atom:updated>2018-06-12T11:54:05.895Z</atom:updated>
            <content:encoded><![CDATA[<p>So, a few days ago I saw tweet from <a href="https://medium.com/@kyle.robert.gill">Kayle Gill</a> about building static e-commerce site using <a href="https://www.gatsbyjs.org/">GatsbyJs</a>. That time I was in process of building an e-commerce website for my wife using NextJs (which is also awesome!).</p><p>Instead of building the site with NextJs I gave GatsbyJs a try. Within 3 days from Sketch design to the Live site, I made the site live. After that I tweeted about it and found that people are really interested in it.</p><h3>Perminder Klair on Twitter</h3><p>Never expected to create a Static Ecommerce site using amazing @gatsbyjs , payment using @stripe and @contentful as cms. Done layout using @sketchapp. Site is live at https://t.co/JA19w81pLZ (sorry about bad quality content, still sorting out). Should I make it open source?</p><p>Live demo of the site can be found here <a href="https://www.sejalsuits.co.uk/">https://www.sejalsuits.co.uk/</a></p><p>I decided to open source the code of the site, it’s on Github now and I will keep developing and pushing code there and keeping the code clean as much as possible so that anyone can pick it up and use without making huge changes. Keeping things simple.</p><p><a href="https://github.com/perminder-klair/gatsbyjs-ecommerce">perminder-klair/gatsbyjs-ecommerce</a></p><p>Also, API is on api branch, <a href="https://github.com/perminder-klair/gatsbyjs-ecommerce/tree/api">here it is</a>.</p><p>While its open sourced now, I thought of writing a little article to fully understand it. So here we go.</p><p><strong>Stack:</strong></p><ul><li>GatsbyJs (to build static site)</li><li>Contentful (Headless CMS)</li><li>Apollo Graphql (API for few mutations)</li></ul><p><strong>Services I used:</strong></p><ul><li>Netlify (to host GatsbyJs static site)</li><li>Now (to host Apollo API)</li><li>Contentful (to host data and CMS)</li><li>Stripe (Process payment)</li><li>Mailchimp (Subscription box)</li><li>Mailgun (Sending emails)</li><li>Blog (using Medium)</li></ul><h3>Frontend (static site)</h3><p><strong>Setup</strong></p><p>To change site config ./src/config/index.js</p><p>also add .envfile in the root, with content for example:</p><blockquote>CONTENTFUL_SPACE_ID=YOUR_KEY_HERE<br>CONTENTFUL_DELIVERY_API_TOKEN=YOUR_KEY_HERE<br>STRIPE_PUBLISHABLE_KEY=YOUR_KEY_HERE</blockquote><p>Run:</p><blockquote>yarn install</blockquote><p>To start development server</p><blockquote>yarn start</blockquote><p>Also added layout’s sketch file SejalSuits.sketchif anyone need it just in case, it’s in github repo.</p><h3>Backend (for sending data to contentful and some mails)</h3><p>We use API based on Apollo GraphQL Server. We use it for few mutations we got to send data to Contentful and some emails. It works for me, you can choose your stack to go with serverless or whatever you prefer.</p><p>To change API config ./src/config.js<br>You can also add .envfile in the root, with content for example:</p><blockquote>CONTENTFUL_SPACE_ID=YOUR_KEY_HERE<br>CONTENTFUL_DELIVERY_API_TOKEN=YOUR_KEY_HERE<br>MAILGUN_USER=YOUR_KEY_HERE<br>MAILGUN_PASSWORD=YOUR_KEY_HERE<br>MAILCHIMP_KEY=YOUR_KEY_HERE<br>MAILCHIMP_LIST=YOUR_KEY_HERE<br>STRIPE_KEY=YOUR_KEY_HERE<br>CONTENTFUL_SPACE_ID=YOUR_KEY_HERE<br>CONTENTFUL_MANAGEMENT_ACCESS_TOKEN=YOUR_KEY_HERE</blockquote><p>Run:</p><blockquote>yarn install</blockquote><p>To start development server</p><blockquote>yarn start</blockquote><p>For reference in setting up fields in Contentful’s Content Model, I have added some JSON files in the directory: ./contentful_fields</p><p>If you have any suggestions or fixes in mind to improve code base, feel free to comment below or make PR request.</p><p>By the way, this was my first article on medium and hopefully, it made some sense. Many thanks for your time.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=a349d7e022a" width="1" height="1" alt=""><hr><p><a href="https://medium.com/zeiq/creating-static-e-commerce-site-with-gatsbyjs-a349d7e022a">Creating Static E-commerce site with GatsbyJs</a> was originally published in <a href="https://medium.com/zeiq">Zeiq</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[About Sejal Suits]]></title>
            <link>https://medium.com/sejal-suits/first-article-dec8b7d23294?source=rss-47712d2d10a8------2</link>
            <guid isPermaLink="false">https://medium.com/p/dec8b7d23294</guid>
            <dc:creator><![CDATA[Perminder Klair]]></dc:creator>
            <pubDate>Fri, 08 Jun 2018 05:51:56 GMT</pubDate>
            <atom:updated>2018-06-08T06:54:34.779Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*PTygtbXeGw3hGh_Ef2jB9g.jpeg" /></figure><p>Shop for authentic Punjabi suits online from Sejal Suits and be prepared to turn heads and win admiring glances with your unique style statement.</p><p>Sejal Suits specialises in traditional Punjabi suits bringing you the finest authentic punjabi designs online. Shop online for the best in punjabi fashion.</p><p>Shop for authentic Punjabi suits online from Sejal Suits and be prepared to turn heads and win admiring glances with your unique style statement.</p><p>Sejal Suits specialises in traditional Punjabi suits bringing you the finest authentic punjabi designs online. Shop online for the best in punjabi fashion.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=dec8b7d23294" width="1" height="1" alt=""><hr><p><a href="https://medium.com/sejal-suits/first-article-dec8b7d23294">About Sejal Suits</a> was originally published in <a href="https://medium.com/sejal-suits">Sejal Suits</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Welcome]]></title>
            <link>https://medium.com/@pinku1/welcome-f6f20733be7?source=rss-47712d2d10a8------2</link>
            <guid isPermaLink="false">https://medium.com/p/f6f20733be7</guid>
            <dc:creator><![CDATA[Perminder Klair]]></dc:creator>
            <pubDate>Sat, 04 Nov 2017 06:14:34 GMT</pubDate>
            <atom:updated>2017-11-04T06:14:34.677Z</atom:updated>
            <content:encoded><![CDATA[<p>Just first post, to check everything is working fine. If you can read this, please comment below ;)</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=f6f20733be7" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Simple NodeJs Pagination]]></title>
            <link>https://medium.com/digitalaholic/simple-nodejs-pagination-a2d787b77581?source=rss-47712d2d10a8------2</link>
            <guid isPermaLink="false">https://medium.com/p/a2d787b77581</guid>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[nodejs]]></category>
            <dc:creator><![CDATA[Perminder Klair]]></dc:creator>
            <pubDate>Tue, 11 Oct 2016 16:34:01 GMT</pubDate>
            <atom:updated>2016-10-11T16:36:11.358Z</atom:updated>
            <content:encoded><![CDATA[<p>This is really simple example tutorial about how to crate pagination in NodeJs Application (it also covers ExpressJs Framework).</p><p>We will be using EJS templating system for demo purpose.</p><p>### Setup Application<br>To, start the tutorial let’s setup a new simple ExpressJs application by creating a file named `package.json` with following content:</p><p>```language-json<br>{<br> “name”: “nodejs-pagination”,<br> “version”: “0.0.1”,<br> “dependencies”: {<br> “ejs”: “~0.8.4”,<br> “express”: “~4.2.0”<br> },<br> “engines”: {<br> “node”: “&gt;=0.10.0”<br> }<br>}<br>```</p><p>Then we will need to install required dependencies using `npm install` in the terminal. It will install all the required dependencies under `node_modules` directory.</p><p>### Create Index File to load App<br>Ok, now we have our simple demo application ready, let’s create a file which we will be using to run the application. So, go ahead and create `index.js` file with the following content:<br>```language-javascript<br>var express = require(‘express’);<br>var app = express();</p><p>app.set(‘views’, ‘views’);<br>app.engine(‘html’, require(‘ejs’).renderFile);<br>app.set(‘view engine’, ‘ejs’);</p><p>app.get(‘/’, function(req, res){</p><p>//set default variables<br> var totalStudents = 80,<br> pageSize = 8,<br> pageCount = 80/8,<br> currentPage = 1,<br> students = [],<br> studentsArrays = [], <br> studentsList = [];</p><p>//genreate list of students<br> for (var i = 1; i &lt; totalStudents; i++) {<br> students.push({name: ‘Student Number ‘ + i});<br> }</p><p>//split list into groups<br> while (students.length &gt; 0) {<br> studentsArrays.push(students.splice(0, pageSize));<br> }</p><p>//set current page if specifed as get variable (eg: /?page=2)<br> if (typeof req.query.page !== ‘undefined’) {<br> currentPage = +req.query.page;<br> }</p><p>//show list of students from group<br> studentsList = studentsArrays[+currentPage — 1];</p><p>//render index.ejs view file<br> res.render(‘index’, {<br> students: studentsList,<br> pageSize: pageSize,<br> totalStudents: totalStudents,<br> pageCount: pageCount,<br> currentPage: currentPage<br> });<br>});</p><p>var server = app.listen(3000, function() {<br> console.log(‘Listening on port %d’, server.address().port);<br>});<br>```</p><p>Let me explain this file, it’s really simple ExpressJs setup.</p><p>- First we initialize the ExpressJs App.</p><p>- Then we create a list of about 80 students.</p><p>- Then with a really simple trick, we split list of students. (I done this just for demo purpose). In real world applications we will get data from remote server or local database.</p><p>- Using line: `currentPage = +req.query.page;` we set current requested page eg: `<a href="http://localhost:3000/?page=2`">http://localhost:3000/?page=2`</a>.</p><p>- Finally, we pass all de required data to our view file, which we are going to create in next step.</p><p>If you want to learn more about ExpressJs Framework, follow this link: [<a href="http://expressjs.com/guide.html](http://expressjs.com/guide.html)">http://expressjs.com/guide.html](http://expressjs.com/guide.html)</a></p><p>### Create View file<br>Now, last step of app is create view file, which we are going name as `index.ejs` in `views` directory.<br>```language-html<br>&lt;ul class=”list-group”&gt;<br> &lt;% students.forEach( function( student ) { %&gt;<br> &lt;li class=”list-group-item”&gt;&lt;%= student.name %&gt;&lt;/li&gt;<br> &lt;% }) %&gt;<br>&lt;/ul&gt;</p><p>&lt;% if (pageCount &gt; 1) { %&gt;<br>&lt;ul class=”pagination”&gt;<br> &lt;% if (currentPage &gt; 1) { %&gt;<br> &lt;li&gt;&lt;a href=”/?page=1&quot;&gt;&amp;laquo;&lt;/a&gt;&lt;/li&gt;<br> &lt;% } %&gt;<br> &lt;% var i = 1;<br> if (currentPage &gt; 5) {<br> i = +currentPage — 4;<br> } %&gt;<br> &lt;% if (i !== 1) { %&gt;<br> &lt;li class=”disabled”&gt;&lt;a href=”#”&gt;…&lt;/a&gt;&lt;/li&gt;<br> &lt;% } %&gt;<br> &lt;% for (i; i&lt;=pageCount; i++) { %&gt;<br> &lt;% if (currentPage == i) { %&gt;<br> &lt;li class=”active”&gt;&lt;span&gt;&lt;%= i %&gt; &lt;span class=”sr-only”&gt;(current)&lt;/span&gt;&lt;/span&gt;&lt;/li&gt;<br> &lt;% } else { %&gt;<br> &lt;li&gt;&lt;a href=”/?page=&lt;%= i %&gt;”&gt;&lt;%= i %&gt;&lt;/a&gt;&lt;/li&gt;<br> &lt;% } %&gt;<br> &lt;% if (i == (+currentPage + 4)) { %&gt;<br> &lt;li class=”disabled”&gt;&lt;a href=”#”&gt;…&lt;/a&gt;&lt;/li&gt;<br> &lt;% break; } %&gt;<br> &lt;% } %&gt;<br> &lt;% if (currentPage != pageCount) { %&gt;<br> &lt;li&gt;&lt;a href=”/?page=&lt;%= pageCount %&gt;”&gt;&amp;raquo;&lt;/a&gt;&lt;/li&gt;<br> &lt;% } %&gt;<br>&lt;/ul&gt;<br>&lt;% } %&gt;<br>```<br>To complete the tutorial about expample include basic pagination. This is a simple EJS Embedded JavaScript file. More info on EJS can be found here: [<a href="http://embeddedjs.com/](http://embeddedjs.com/).">http://embeddedjs.com/](http://embeddedjs.com/).</a></p><p>This is really basic example to demonstrate, you can amend it according to your needs.</p><p>### Run the application</p><p>Finally, to run the application and to see NodeJs Pagination in action run the following command in your terminal:</p><p>`node index.js`</p><p>Once it’s done, visit the page: <a href="http://localhost:3000/">http://localhost:3000</a> . On this page try to go different pages by clicking on pagination.</p><p>Hopefully this tutoral will help you in creating a really simple pagination for your nodejs application.</p><p>If you are looking for full source code from this tutorial, I have pushed it to github: [<a href="https://github.com/perminder-klair/nodejs-pagination-demo](https://github.com/perminder-klair/nodejs-pagination-demo)">https://github.com/perminder-klair/nodejs-pagination-demo](https://github.com/perminder-klair/nodejs-pagination-demo)</a> .</p><p>Any question regarding tutorial? Feel free to ask by using comment box below.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=a2d787b77581" width="1" height="1" alt=""><hr><p><a href="https://medium.com/digitalaholic/simple-nodejs-pagination-a2d787b77581">Simple NodeJs Pagination</a> was originally published in <a href="https://medium.com/digitalaholic">DigitalAholic</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
    </channel>
</rss>