<?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 Eduardo Pineda on Medium]]></title>
        <description><![CDATA[Stories by Eduardo Pineda on Medium]]></description>
        <link>https://medium.com/@sepineda?source=rss-6123cfa1286c------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*2i6BMaV_qXCg0tGpIZncxg.jpeg</url>
            <title>Stories by Eduardo Pineda on Medium</title>
            <link>https://medium.com/@sepineda?source=rss-6123cfa1286c------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sat, 28 Nov 2026 18:04:14 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@sepineda/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[The revolution of Frontend Development roles]]></title>
            <description><![CDATA[<div class="medium-feed-item"><p class="medium-feed-image"><a href="https://sepineda.medium.com/the-revolution-of-frontend-development-roles-4e2e1487abd3?source=rss-6123cfa1286c------2"><img src="https://cdn-images-1.medium.com/max/2000/0*FY_W2U1ux_-S_5mc" width="2000"></a></p><p class="medium-feed-snippet">A role as a library/framework expert is something that will help you to advance in your career as you master the technology stack and&#x2026;</p><p class="medium-feed-link"><a href="https://sepineda.medium.com/the-revolution-of-frontend-development-roles-4e2e1487abd3?source=rss-6123cfa1286c------2">Continue reading on Medium »</a></p></div>]]></description>
            <link>https://sepineda.medium.com/the-revolution-of-frontend-development-roles-4e2e1487abd3?source=rss-6123cfa1286c------2</link>
            <guid isPermaLink="false">https://medium.com/p/4e2e1487abd3</guid>
            <category><![CDATA[angular]]></category>
            <category><![CDATA[vuejs]]></category>
            <category><![CDATA[react]]></category>
            <category><![CDATA[software-development]]></category>
            <category><![CDATA[javascript]]></category>
            <dc:creator><![CDATA[Eduardo Pineda]]></dc:creator>
            <pubDate>Fri, 04 Jun 2021 12:46:38 GMT</pubDate>
            <atom:updated>2021-06-04T18:46:01.018Z</atom:updated>
        </item>
        <item>
            <title><![CDATA[Introduction to Cloud Architecture]]></title>
            <description><![CDATA[<div class="medium-feed-item"><p class="medium-feed-image"><a href="https://sepineda.medium.com/introduction-to-cloud-architecture-69423e3d9eb5?source=rss-6123cfa1286c------2"><img src="https://cdn-images-1.medium.com/max/640/0*tQteI8_rAMOoIdpw.jpg" width="640"></a></p><p class="medium-feed-snippet">Published September 7th, 2020</p><p class="medium-feed-link"><a href="https://sepineda.medium.com/introduction-to-cloud-architecture-69423e3d9eb5?source=rss-6123cfa1286c------2">Continue reading on Medium »</a></p></div>]]></description>
            <link>https://sepineda.medium.com/introduction-to-cloud-architecture-69423e3d9eb5?source=rss-6123cfa1286c------2</link>
            <guid isPermaLink="false">https://medium.com/p/69423e3d9eb5</guid>
            <category><![CDATA[cloud-computing]]></category>
            <category><![CDATA[software-development]]></category>
            <category><![CDATA[software-architecture]]></category>
            <dc:creator><![CDATA[Eduardo Pineda]]></dc:creator>
            <pubDate>Mon, 14 Sep 2020 23:14:51 GMT</pubDate>
            <atom:updated>2020-09-14T23:14:51.487Z</atom:updated>
        </item>
        <item>
            <title><![CDATA[Building a static blog site with Markdown and Next.js]]></title>
            <description><![CDATA[<div class="medium-feed-item"><p class="medium-feed-image"><a href="https://itnext.io/building-a-static-blog-site-with-markdown-and-next-js-702c515389b3?source=rss-6123cfa1286c------2"><img src="https://cdn-images-1.medium.com/max/2600/1*vPjKNWCkZ4Bp2pMp2oUesA.jpeg" width="3304"></a></p><p class="medium-feed-snippet">In recent times we have seen the emergence of new technologies and the evolution of development tools and services on such a scale that we&#x2026;</p><p class="medium-feed-link"><a href="https://itnext.io/building-a-static-blog-site-with-markdown-and-next-js-702c515389b3?source=rss-6123cfa1286c------2">Continue reading on ITNEXT »</a></p></div>]]></description>
            <link>https://itnext.io/building-a-static-blog-site-with-markdown-and-next-js-702c515389b3?source=rss-6123cfa1286c------2</link>
            <guid isPermaLink="false">https://medium.com/p/702c515389b3</guid>
            <category><![CDATA[reactjs]]></category>
            <category><![CDATA[react]]></category>
            <category><![CDATA[nextjs]]></category>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[markdown]]></category>
            <dc:creator><![CDATA[Eduardo Pineda]]></dc:creator>
            <pubDate>Wed, 22 Jan 2020 14:59:42 GMT</pubDate>
            <atom:updated>2020-01-24T15:44:04.601Z</atom:updated>
        </item>
        <item>
            <title><![CDATA[Boosting Programming Productivity]]></title>
            <link>https://sepineda.medium.com/boosting-programming-productivity-b8b892fa2b23?source=rss-6123cfa1286c------2</link>
            <guid isPermaLink="false">https://medium.com/p/b8b892fa2b23</guid>
            <category><![CDATA[software-development]]></category>
            <category><![CDATA[productivity]]></category>
            <category><![CDATA[programming]]></category>
            <category><![CDATA[time-management]]></category>
            <dc:creator><![CDATA[Eduardo Pineda]]></dc:creator>
            <pubDate>Thu, 17 Jan 2019 14:53:05 GMT</pubDate>
            <atom:updated>2019-01-17T14:57:18.833Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*W97wDE2nXrKUzDxiftficA.jpeg" /></figure><p>After some years working as Software Engineer/Developer, we start noticing that no matter of the role, company, programming language or any other specific detail related to our work.</p><p>There is always a common factor and is our method to deal with any kind of problem, technical and non-technical, that defines how effective we are in our work.</p><p>We create a method (consciously or unconsciously), a pattern or mental algorithm we apply in our daily tasks. It can vary of course depending on the nature of the problem. But does this method deliver the best results? Is our performance optimal, or maybe we can do better?.</p><p>Perhaps for you, as it happened to me, there is some kind of duties in which we have a better performance and others that make us struggle for our, days or even more, without finding a good and fast way to deliver what we’ve been asked to.</p><p>For Software Engineers, the kind of problems we have to work with is mostly technical in nature. <strong>Technical problems requires to be completed within the metrics of time and quality</strong>.</p><p>Of course, our performance (focused on technical tasks) and effectiveness (focused on teamwork) will depend on our experience level. A junior developer has different skills and experience than a senior developer. Nevertheless, for every experience level, there is always room for improvement. For junior devs, it might be defining the goals of increasing production capacity by learning the advanced concepts required for higher responsibility roles, which is done by taking courses or certifications and gradually getting more challenging projects. For an advanced developer, it might learning how to be an effective leader and helping new developers, or taking full responsibility for the architecture of a new project.</p><p>In this article, we’re going to make a review of good practices, techniques and mental paradigms that can help us to increase our performance in the short term, for specific and objective based tasks. But we’ll also learn how to be effective Software Developers in the long terms by staying focus in the things that matter and tracing a roadmap for our goals.</p><h3>P/PC Balance</h3><p>I’ll borrow this concept of P/PC balance from <a href="https://en.wikipedia.org/wiki/Stephen_Covey">Stephen Covey</a>’s book <a href="https://en.wikipedia.org/wiki/The_7_Habits_of_Highly_Effective_People"><em>The 7 Habits of Highly Effective People</em></a> (I personally recommend this book for anyone, not just developers or professionals, it contains knowledge for life): <strong>Production</strong> vs <strong>Production Capacity</strong>. Many times, developers focus almost exclusively on production, so much that easily forget to improve their production capacity.</p><p>We can find an excellent example of the balance P/PC on modern front-end development. A front-end developer needs to keep always up to date on new JavaScript frameworks (e.g., React, Angular or Vue) to not be left behind on new opportunities. Even when working with a specific framework (let’s say React), she/he needs to keep up with changes in new versions, to be able to improve the product over time integrating the improvements on those new versions. This is the importance of working on our Production Capacity.</p><p>On the other hand, we can’t afford to focus only on PC and spend most of our time studying and learning about new frameworks and technologies and forget about our tasks and deadlines (the Production), that would make all the effort in learning pointless.</p><p>The best way to have a P/PC balance is setting our learning goals in short or mid-term (take a course on <em>X</em> or <em>Y</em> cloud technology or learning a new <em>Z</em> JS framework) and create a schedule where we reserve 3 or 4 hours a week for that purpose. It’s an extra mile in our program, but it’s worth it as it’s going to return the investment.</p><h3>Career Path &amp; Goals</h3><p>We talked about the importance of Production and Production Capacity and that we need to set short or mid-term goals to improve Production Capacity. Now let’s think in the long term. Software Developers as any other professional follows a career path based on her/his own interests and personal goals.</p><p>The first step then is to define a set of goals for the mid or long term, where do you see yourself in the next 5 years, in the next 10 years?. Perhaps you picture yourself as a technical leader, a Project Manager or as an Architect, it depends on what you want.</p><p>As engineers we use to think in the structure, the procedure, the “hows” to achieve something, how we administrate resources and get the maximum efficiency in design or task, in other words, we use the rational left hemisphere of the brain. However, when it comes to make a career plan and trace goals, we need to step aside and think with the right hemisphere of the brain, the imagination to see all the possibilities and choose what we really love to do to, what challenges we’d like to embrace to become an even better versions of ourselves.</p><p>Productivity increases when we specialize and become really good at doing something. So in the mid/long term, as we think what’s the next steps in our careers and pick an area of specialization. This is also important, so we promote ourselves ahead of the competition. But what options we have?. There is a bunch of specialties we can choose from in the next years :</p><ul><li><strong>Front-end</strong>: Developing client-side web applications (apps which live in the browser).<br> <strong><em>skills</em></strong>: JavaScript, HTML, CSS, SQL.</li><li><strong>Embedded and Application</strong>: Typically developing embedded software, like firmware for network devices and Internet of Things.<br> <strong><em>skills</em></strong>: Embedded Systems/Software, C, Linux, Testing, Debugging.</li><li><strong>Infrastructure and Cloud Computing</strong>: This category includes what traditionally was called back-end development, which has gradually evolved into the cloud.<br> <strong><em>skills</em></strong>: Databases, Business Intelligence, Data Warehousing, Containers, Cloud &amp; Distributing Systems, Web Servers.</li><li><strong>Machine Learning and Data Science</strong>: A specialty related to business domain knowledge, Mathematics/Statistics and Computer Science. Data Scientists create models to help a company make business decisions based on substantial data sets (Big Data).<br> <strong><em>skills</em></strong>: Machine Learning, Python, Algorithms, Hadoop, Statistics, Data Mining.</li><li><strong>Mobile</strong>: Development of mobile applications for Android and iOS, which is done natively or using a third-party framework (i.e., React Native, Ionic, Apache Cordova).<br> <strong><em>skills</em></strong>: Android/iOS development, Java, Kotlin, JavaScript, Swift.</li><li><strong>Test and Quality Assurance</strong>: This role is about designing tests and knowing about the development operations and CI/CD tools to integrate quality into the product as a first-class citizen.<br> <strong><em>skills</em></strong>: QA, Test planning, Test Automation, Regression Testing, Jenkins, Selenium.</li></ul><h3>Planning</h3><p>Once we have a well-defined set of goals for our career future, it’s time to trace a plan, that includes a schedule, resources (e.g., time, money) and a proper series of steps to achieve each goal.</p><p>Our plan might include a series of steps or tasks oriented to achieve a specific goal, for example, to get a certification or complete a course on a subject, we need to book a certain amount of hours a week and also save some bucks to afford it.</p><p>I would recommend to make a schedule and specify all your tasks and make a balance on your available time. We don’t want to put so much work and forget about getting some time off for ourselves, family and friends. We need to put enough time to get the desired results.</p><p>An essential part on administrating our time and money resources is setting the right priority to all our activities. We can have the discipline and put so much effort, but if all that work goes to the wrong places, we still won´t get the right results.</p><p>How can we identify where we need to make most of the work?. The next diagram (from Stephen Covey’s 7 Habits book) shows the relation between urgent and important activities.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/460/0*sR_-yuptdxqxREoz.png" /></figure><p>There are four quadrants, for low and high levels of importance and urgency, where we classify the tasks on our plan and daily work.</p><p>The quadrant where we have to live is the II: The tasks that are important, but not urgent. If we think about what’s critical, we realize that urgency comes from the needs of other people or from the crisis we have to attend.</p><p>Of course, we have to attend to other’s needs in our work, but there’s a line of respect to our time if a project we’re working on is getting done right according to plan and schedule, then there shouldn’t be urgent needs from any member on a team. Some people get used to working under pressure, where all tasks are critical, but nothing gets really done in time; actually, they have a lot of pending things in a backlog of work. This is not good, it leads to frustration and general unhappiness.</p><p>On the other hand, if we spend most of the time on not necessary, not urgent tasks, there’s merely no progress, in the end, we’ll fail in our duties.</p><p>By staying in the things necessary, but not urgent, we prevent future crisis and always keep getting results and benefits over time.</p><h3>Tracking and Focus methods</h3><p>Now we have defined our goals and made a list of tasks or steps to achieve each goal. It’s time to deal with the performance to do a specific work and how to keep track of all the functions so with don’t miss any important one in the way. The key in the short term (the work we do in a day) is then keeping focused on the task, and in the long run (over the several days or weekend(s)) is keeping track of pending and completed tasks.</p><p>There is a popular focus method that I’ve found works very well for programming (as well as with other professional activities): the <a href="https://en.wikipedia.org/wiki/Pomodoro_Technique">Pomodoro Technique</a>. It’s a time management technique designed to put all your attention on the work you’re doing in time batches of 25 minutes (a Pomodoro), separated by short breaks, typically 5 minutes, and a long break every 4 pomodoros.<br> By putting full attention in a task, you dramatically increase productivity avoiding many of the distractors you may have, like your smartphones, social media, e-mail and others, while you’re working in a Pomodoro, but then have a break to check any of the previous before getting back to work.</p><p>The Pomodoro technique works better when you classify the tasks we’re going to work on. We can make use of <a href="https://en.wikipedia.org/wiki/Kanban">Kanban</a> (a Japanese method originally created for manufacturing at Toyota) boards to organize and schedule our work in categories, for example: <em>To do</em>, <em>For today</em>, <em>In Progress</em> and <em>Done</em>, and move from left to right while we’re making progress in each task.</p><p>I recommend an excellent tool that combines both, the Pomodoro Technique and Kanban boards: <a href="https://kanbanflow.com/">KanbanFlow</a>. It’s an online app, totally free, you just need to create an account and start enjoying it.</p><p>A final piece of advice is to start the work or study day by creating a bunch of tasks to achieve a day goal and organize the jobs, in this way you ensure to keep productive by not stop thinking what’s next constantly over the day.</p><p>Thank you so much for reading this article. Take care and talk to you again with more Full-Stack development topics. Cheers!.</p><p><em>Originally published at </em><a href="https://fullstackengine.net/boosting-programming-productivity/"><em>fullstackengine.net</em></a><em> on January 17, 2019.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=b8b892fa2b23" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[React/Redux Interview Questions]]></title>
            <description><![CDATA[<div class="medium-feed-item"><p class="medium-feed-image"><a href="https://sepineda.medium.com/react-redux-interview-questions-b7f6611823f?source=rss-6123cfa1286c------2"><img src="https://cdn-images-1.medium.com/max/1013/0*P0ZDhHHdOydl7xyT.png" width="1013"></a></p><p class="medium-feed-snippet">React is one of the most popular and influential JavaScript frameworks in recent times. Its popularity has only become more and bigger, as&#x2026;</p><p class="medium-feed-link"><a href="https://sepineda.medium.com/react-redux-interview-questions-b7f6611823f?source=rss-6123cfa1286c------2">Continue reading on Medium »</a></p></div>]]></description>
            <link>https://sepineda.medium.com/react-redux-interview-questions-b7f6611823f?source=rss-6123cfa1286c------2</link>
            <guid isPermaLink="false">https://medium.com/p/b7f6611823f</guid>
            <category><![CDATA[redux]]></category>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[react]]></category>
            <category><![CDATA[interview]]></category>
            <category><![CDATA[front-end-development]]></category>
            <dc:creator><![CDATA[Eduardo Pineda]]></dc:creator>
            <pubDate>Mon, 26 Nov 2018 00:59:58 GMT</pubDate>
            <atom:updated>2020-01-09T17:05:20.774Z</atom:updated>
        </item>
        <item>
            <title><![CDATA[Full Stack JavaScript Interview Questions]]></title>
            <link>https://sepineda.medium.com/full-stack-javascript-interview-questions-c132ec2c46a3?source=rss-6123cfa1286c------2</link>
            <guid isPermaLink="false">https://medium.com/p/c132ec2c46a3</guid>
            <category><![CDATA[computer-science]]></category>
            <category><![CDATA[nodejs]]></category>
            <category><![CDATA[interview-questions]]></category>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[interview]]></category>
            <dc:creator><![CDATA[Eduardo Pineda]]></dc:creator>
            <pubDate>Mon, 30 Jul 2018 22:39:18 GMT</pubDate>
            <atom:updated>2019-06-04T13:49:02.795Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*PbvUpDqTDJQBJBvqlVOAhQ.jpeg" /></figure><p>JavaScript is in high demand nowadays, it’s become prevalent as it is possible to create applications on the full stack, back-end with Node.js, databases with a wide variety (like MongoDB or RethinkDB) and a even bigger range of options when it comes to the front-end (React, Angular, Vue, Ember, to name a few).<br> Given the so many opportunities, developers specialize (or they should) in a particular stack, like React or Angular in combination with Node.js and MongoDB. However, they all have something in common: JavaScript.</p><p>In this post, we’ll see what the basics every full-stack developer should master and crack some of the common questions you might face in a job interview are.<br> You might wonder what a recruiter, for a Full-Stack position in JavaScript is looking for, let’s summarize some of these basics:</p><ol><li><a href="https://fullstackengine.net/fullstack-javascript-interview-questions-2/#javascript"><strong>JavaScript</strong></a>. Naturally, the first a recruiter wants to know is your mastery in the language. You might expect questions related to programming paradigms (Functional, OOP, Structured/procedural), scope modifiers, data types, ES6 syntax, promises, among others.</li><li><a href="https://fullstackengine.net/fullstack-javascript-interview-questions-2/#nodejs"><strong>Node.js</strong></a>. It is essential for a Full-Stack developer in JavaScript to master Node.js, concepts go from Non-blocking I/O, callbacks, to EventEmmiter and asynchronous requests.</li><li><a href="https://fullstackengine.net/fullstack-javascript-interview-questions-2/#databaseswebstorage"><strong>Databases &amp; Web Storage</strong></a>. For JavaScript development, we’re especially interested in assessing knowledge in NoSQL databases and how they compare to Relational DB.</li><li><a href="https://fullstackengine.net/fullstack-javascript-interview-questions-2/#httprest"><strong>HTTP &amp; Rest</strong></a>. Full Stack developers should have a strong basis on HTTP and Rest web services, as they are used in every front-end framework (React, Angular, Vue, Ember, etc.).</li><li><a href="https://fullstackengine.net/fullstack-javascript-interview-questions-2/#webapplicationarchitecture"><strong>Web Application Architecture</strong></a>. Every Web developer must have good foundations on Web architecture, including Single Page Apps, Multi-page apps, monolithic vs. microservices architectures and Design Patterns.</li><li><a href="https://fullstackengine.net/fullstack-javascript-interview-questions-2/#algorithmsdatastructures"><strong>Algorithms &amp; Data Structures</strong></a>. This category is universal, it’s expected that any software developer knows how to solve these kinds of problems.</li></ol><p>If you’re looking for questions on Full-Stack interview questions (besides JavaScript), you can find this article very useful: <a href="https://www.toptal.com/full-stack/interview-questions">10 Essential Full-stack Interview Questions *</a></p><p>Then, let’s start our tour through some of the questions we can encounter in every category.</p><h3>JavaScript</h3><p>JavaScript is a multi-paradigm language, supporting imperative/procedural programming along with OOP (Object-Oriented Programming) and functional programming. JavaScript supports OOP with prototypal inheritance.</p><p><strong>Good to hear:</strong></p><ul><li>Prototypal inheritance (also: prototypes, OLOO).</li><li>Functional programming (also: closures, first-class functions, lambdas).</li><li>Object-oriented programming (even: es6 classes, super, factories, getter/setter)</li></ul><p><strong>Red flags:</strong></p><ul><li>No clue what a paradigm is, no mention of prototypal oo, OOP or functional programming.</li></ul><h3>What are two-way data binding and one-way data flow, and how are they different?</h3><p>Two-way data binding means that UI fields are bound to model data dynamically such that when a UI field changes, the model data changes with it and vice-versa.</p><p>One way data flow means that the model is the single source of truth. Changes in the UI trigger messages that signal user intent to the model (or “store” in React). Only the model has access to change the app’s state. The effect is that data always flows in a single direction, which makes it easier to understand.</p><p>One way data flows are deterministic, whereas two-way binding can cause side-effects which are harder to follow and understand.</p><h3>What is functional programming?</h3><p>Functional programming produces programs by composing mathematical functions and avoids shared state &amp; mutable data. Lisp (specified in 1958) was among the first languages to support functional programming and was heavily inspired by lambda calculus. Lisp and many Lisp family languages are still in everyday use today.</p><p>Functional programming is an essential concept in JavaScript (one of the two pillars of JavaScript). Several common useful utilities were added to JavaScript in ES5.</p><h3>What is Object Oriented Programming?</h3><p><strong>Object-oriented programming (OOP)</strong> is a programming paradigm based on the concept of “objects,” which may contain data, in the form of fields, often known as attributes; and code, in the form of procedures, often known as methods. A feature of objects is that an object’s procedures can access and often modify the data fields of the object with which they are associated (objects have a notion of “this” or “self”). In OOP, computer programs are designed by making them out of objects that interact with one another. There is a significant diversity of OOP languages, but the most popular ones are class-based, meaning that objects are instances of classes, which typically also determine their type.</p><h3>What does “favor object composition over class inheritance” mean?</h3><p>This is a quote from <a href="http://www.amazon.com/Design-Patterns-Elements-Reusable-Object-Oriented/dp/0201633612">“Design Patterns: Elements of Reusable Object-Oriented Software”</a>. It means that code reuse should be achieved by assembling smaller units of functionality into new objects instead of inheriting from classes and creating object taxonomies.</p><p>In other words, use can-do, has-a, or uses-a relationships instead of is-a relationships.</p><p><strong>Good to hear:</strong></p><ul><li>Avoid class hierarchies.</li><li>Avoid brittle base class problem.</li><li>Avoid tight coupling.</li><li>Avoid rigid taxonomy (forced is-a relationships that are eventually wrong for new use cases).</li><li>Avoid the gorilla banana problem (“what you wanted was a banana, what you got was a gorilla holding the banana, and the entire jungle”).</li><li>Make code more flexible.</li></ul><p><strong>Red Flags:</strong></p><ul><li>Fail to mention any of the problems above.</li><li>Fail to articulate the difference between composition and class inheritance, or the advantages of <em>composition</em>.</li></ul><h3>Coding</h3><h3>How do you clone an object?</h3><pre>var obj = {a: 1 ,b: 2} var objclone = Object.assign({},obj);</pre><h3>What will the following code print?</h3><pre>for (var i = 0; i &lt; 5; i++) { setTimeout(function() { console.log(i); }, i * 1000 ); }</pre><p>Answer: 5 5 5 5 5</p><h3>How can modify the previous code to produce a count like 1 2 3 4 5?</h3><pre>for (let i = 0; i &lt; 5; i++) { setTimeout(function() { console.log(i); }, i * 1000 ); }</pre><h3>In what order will the numbers 1–4 be logged to the console when the code below is executed? Why?</h3><pre>(function() { console.log(1); setTimeout(function(){console.log(2)}, 1000); setTimeout(function(){console.log(3)}, 0); console.log(4); })();</pre><h3>Node.js</h3><p>Node.js is a run-time JavaScript environment built on top of Chrome’s V8 engine. It uses an event-driven, non-blocking I/O model. It is lightweight and so efficient. Node.js has a package ecosystem called npm.</p><p>Node.js can be used to build different types of applications such as web application, real-time chat application, REST API server, etc. However, it is mainly used to build network programs like web servers, similar to PHP, Java, or ASP.NET. Node.js was developed by Ryan Dahl in 2009.</p><h3>What is Event-driven programming?</h3><p>Event-driven programming is building our application based on and respond to events. When an event occurs, like click or keypress, we are running a callback function which is registered to the element for that event.</p><p>Event-driven programming follows mainly a publish-subscribe pattern.</p><h3>What is the difference between Asynchronous and Non-blocking?</h3><p>Asynchronous literally means not synchronous. We are making HTTP requests which are asynchronous, means we are not waiting for the server response. We continue with other block and respond to the server response when we received.</p><p>The term Non-Blocking is widely used with IO. For example, non-blocking read/write calls return with whatever they can do and expect the caller to execute the request again. Read will wait until it has some data and put calling thread to sleep.</p><h3>What is EventEmitter in Node.js?</h3><p>All objects that emit events are instances of the EventEmitter class. These objects expose an eventEmitter.on() function that allows one or more functions to be attached to named events emitted by the object.</p><p>When the EventEmitter object emits an event, all of the functions attached to that specific event are called synchronously.</p><h3>Explain callback in Node.js.</h3><p>A callback function is called at the completion of a given task. This allows other code to be run in the meantime and prevents any blocking. Being an asynchronous platform, Node.js heavily relies on callback. All APIs of Node are written to support callbacks.</p><h3>What does it mean “non-blocking” in node.js?</h3><p>In node.js “non-blocking” means that its IO is non-blocking. Node uses “libuv” to handle its IO in a platform-agnostic way. On windows, it uses completion ports for Unix it uses epoll or kqueue, etc. So, it makes a non-blocking request, and upon a request, it queues it within the event loop which calls the JavaScript ‘callback’ on the main JavaScript thread.</p><h3>What is asynchronous programming, and why is it essential in JavaScript?</h3><p><strong>Good to hear:</strong></p><ul><li>An understanding of what blocking means, and the performance implications.</li><li>A knowledge of event handling, and why its essential for UI code.</li></ul><p><strong>Red flags:</strong></p><ul><li>Unfamiliar with the terms asynchronous or synchronous.</li><li>Unable to articulate performance implications or the relationship between asynchronous code and UI code.</li></ul><h3>Databases &amp; Web Storage</h3><p>NoSQL encompasses a wide variety of different database technologies that were developed in response to a rise in the volume of data stored about users, objects, and products. The frequency at which this data is accessed, and performance and processing needs. Relational databases, on the other hand, were not designed to cope with the scale and agility challenges that face modern applications, nor were they built to take advantage of the cheap storage and processing power available today.</p><h3>Explain the difference between Relation DB vs. NoSQL</h3><p>RDBMS over NoSQL:</p><ul><li>Better for relational data that is structured and organized.</li><li>Organize data through normalization</li><li>Use Structured query language(SQL) which is easy to learn</li><li>Maintains Data Integrity</li><li>Data and its relationships are stored in separate tables</li><li>ACID compliance, i.e., either all the transactions are committed or None</li><li>Scale up/ Vertical Scaling</li></ul><p>NoSQL over RDBMS:</p><ul><li>Better for Unstructured and unpredictable Data</li><li>Handles Big Data</li><li>No predefined schema</li><li>Cheaper to manage</li><li>Scale-out/Horizontal Scaling</li><li>BASE Transaction</li><li>High performance, availability, and scalability</li></ul><h3>What are the different types of NoSQL databases?</h3><p>There are four different categories of NoSQL databases:</p><ol><li><strong>Key-value stores</strong>: The simplest, where every item in the database is stored as an attribute name (or “key”) together with its value. Riak, Voldemort, and Redis are the most well-known in this category.</li><li><strong>Wide-column stores</strong>: It stores the data together as columns instead of rows and is optimized for queries over large datasets. The most popular are Cassandra and HBase.</li><li><strong>Document databases</strong>: It pairs each key with a complex data structure known as a document. Documents can contain many different key-value pairs, or key-array pairs, or even nested documents. MongoDB is the most popular of these databases.</li><li><strong>Graph databases</strong>: They are used to store information about networks, such as social connections. Examples are Neo4J and HyperGraphDB.</li></ol><h3>HTTP &amp; Rest</h3><p>Web Services work on a client-server model where client applications can access web services over the network. Web services provide endpoint URLs and expose methods that can be obtained over the network through client programs written in Java, shell script or any other different technologies.<br> Web services are stateless and don’t maintain user session like web applications.</p><h3>What are different types of Web Services?</h3><p>There are two types of web services:</p><ol><li><strong>SOAP Web Services</strong>: Runs on SOAP protocol and uses XML technology for sending data.</li><li><strong>Restful Web Services</strong>: It’s an architectural style and runs on HTTP/HTTPS protocol almost all the time. REST is a stateless client-server architecture where web services are resources and can be identified by their URIs. Client applications can use HTTP GET/POST methods to invoke Restful web services.</li></ol><h3>What is REST Web Services?</h3><p>REST is the acronym for REpresentational State Transfer. REST is an architectural style for developing applications that can be accessed over the network. REST architectural style was brought in light by Roy Fielding in his doctoral thesis in 2000.</p><p>REST is a stateless client-server architecture where web services are resources and can be identified by their URIs. Client applications can use HTTP GET/POST methods to invoke Restful web services. REST doesn’t specify any specific protocol to use, but in almost all cases it’s used over HTTP/HTTPS. When compared to SOAP web services, these are lightweight and doesn’t follow any standard. We can use XML, JSON, text or any other type of data for request and response.</p><h3>What is a Resource in Restful web services?</h3><p>A resource is the fundamental concept of Restful architecture. A resource is an object with a type, relationship with other resources and methods that operate on it. Resources are identified with their URI, HTTP methods they support and request/response data type and format of data.</p><h3>What are different HTTP Methods supported in Restful Web Services?</h3><p>Restful web services supported HTTP methods are — GET, POST, PUT, DELETE and HEAD.</p><h3>What is localStorage in HTML 5?</h3><p>It is a feature in HTML5 which let us store user data locally within the user’s browser.</p><h3>How it different from Cookies?</h3><ul><li>They are more secure because web pages can access only access data stored by itself.</li><li>They are faster</li><li>Easy to retrieve and write compare to cookies</li><li>Not included with every server request</li><li>Supports a significant amount of data and even won’t affect performance.</li></ul><h3>How it is different from session storage?</h3><p>localStorage stores data with no expiration date whereas sessionStorage stores data for one session</p><h3>Web Application Architecture</h3><p>A single-page application (SPA) is a web application or website that interacts with the user by dynamically rewriting the current page rather than loading entire new pages from a server. This approach avoids interruption of the user experience between successive pages, making the application behave more like a desktop application. In an SPA, either all necessary code — HTML, JavaScript, and CSS — is retrieved with a single page load, or the appropriate resources are dynamically loaded and added to the page as necessary, usually in response to user actions.</p><p>The page does not reload at any point in the process, nor does control transfer to another page, although the location hash or the HTML5 History API can be used to provide the perception and navigability of separate logical pages in the application.<br> Interaction with the single page application often involves dynamic communication with the web server behind the scenes.</p><h4>Multiple-page App</h4><p>Multiple-page applications work in a “traditional” way. Every change, e.g., display the data or submit data back to server requests rendering a new page from the server in the browser. These applications are more extensive than SPAs because they need to be. Due to the amount of content, these applications have many levels of UI.</p><h3>What are two-way data binding and one-way data flow, and how are they different?</h3><p>Two-way data binding means that UI fields are bound to model data dynamically such that when a UI field changes, the model data changes with it and vice-versa.</p><p>One way data flow means that the model is the single source of truth. Changes in the UI trigger messages that signal user intent to the model (or “store” in React). Only the model has access to change the app’s state. The effect is that data always flows in a single direction, which makes it easier to understand.</p><p>One way data flows are deterministic, whereas two-way binding can cause side-effects which are harder to follow and understand.</p><h3>What are the pros and cons of monolithic vs. microservice architectures?</h3><p><strong>Good to hear:</strong></p><ul><li>Positive attitudes toward microservices, despite the higher initial cost vs. monolithic apps. Aware that microservices tend to perform and scale better in the long run.</li><li>Practical about microservices vs. monolithic apps. Structure the app so that services are independent of each other at the code level, but easy to bundle together as a monolithic app in the beginning. Microservice overhead costs can be delayed until it becomes more practical to pay the price.</li></ul><p><strong>Red flags:</strong></p><ul><li>Unaware of the differences between monolithic and microservice architectures.</li><li>Unaware or impractical about the additional overhead of microservices.</li><li>Unaware of the extra performance overhead caused by IPC and network communication for microservices.</li><li>Too negative about the drawbacks of microservices. Unable to articulate ways in which to decouple monolithic apps such that they’re easy to split into microservices when the time comes.</li><li>Underestimates the advantage of independently scalable microservices.</li></ul><h3>What is a design pattern, what are the 3 standard categories?.</h3><p>A software design pattern is a general, reusable solution to a commonly occurring problem within a given context in software design.</p><p><strong>Good to hear:</strong></p><ul><li>Creational Patterns: Deals with the object creation mechanisms.</li><li>Behavioral Patterns: Identify common communication patterns between objects.</li><li>Structural Patterns: Identify a simple way to realize the relationship between entities.</li></ul><p><strong>Red Flags:</strong></p><ul><li>Doesn’t know what a design pattern is.</li><li>Does not identify its uses or intent.</li></ul><h3>Name four design patterns used in JavaScript and a use example of each.</h3><p><strong>Good to hear:</strong></p><h4>Creationals</h4><p>Builder</p><p>Separate the construction of a complex object from its representation, allowing the same construction process to create various representations.</p><p>Factory Method</p><p>Define an interface for creating a single object, but let subclasses decide which class to instantiate. Factory Method allows a “class” defer instantiation to subclasses.</p><p>Singleton</p><p>Ensure a class has only one instance, and provide a global point of access to it.</p><h4>Structural</h4><p>Module</p><p>Group several related elements, such as classes, singletons, methods, globally used, into a single conceptual entity.</p><p>Modules should be Immediately-Invoked-Function-Expressions (IIFE) to allow for private scopes — that is, a closure that protects variables and methods (however, it will return an object instead of a function).</p><p>Proxy</p><p>Provide a surrogate or placeholder for another object to control access to it.</p><p>Adapter or wrapper</p><p>Convert the interface of a class into another interface clients expect. An adapter lets classes work together when they have incompatible interfaces. The enterprise integration pattern equivalent is the translator.</p><h4>Behavioral</h4><p>Strategy</p><p>Define a family of algorithms, encapsulate each one, and make them interchangeable. Strategy lets the algorithm vary independently from clients that use it.</p><p>State</p><p>Allow an object to alter its behavior when its internal state changes. The object will appear to change its class.</p><p>Define a one-to-many dependency between objects where a state change in one object results in all its dependents being notified and updated automatically.</p><p><strong>Red Flags:</strong></p><ul><li>Only know the names of the patterns, but not the use</li><li>Only can name 1 or 2</li></ul><h3>Algorithms &amp; Data Structures</h3><pre>class StackWithMin { constructor() { this.items = []; this.mins = []; } push(value){ if (value &lt;= this.min()) { this.mins.push(value); } this.items.push(value); } pop() { const value = this.items.pop(); if (value === this.min()) { this.mins.pop(); } return value; } min() { if (this.mins.length === 0) { return Number.MAX_SAFE_INTEGER; } else { return this.mins[this.mins.length - 1]; } } }</pre><pre>function findPairs(arr, sum) { const set = new Set(); arr.forEach(x =&gt; { if( set.has(sum - x) ) { console.log(`${x} - ${sum - x}`); } set.add(x); }); } // findPairs([1, 2, 3, 4, 5], 5);</pre><pre>function isUniqueChars(str) { if (str.length &gt; 256) return false; const char_set = []; for(let i = 0; i &lt; str.length; i++) { const val = str[i]; if(char_set[val]) { return false; } char_set[val] = true; } return true; }</pre><p><em>Originally published at </em><a href="https://fullstackengine.net/fullstack-javascript-interview-questions-2/"><em>fullstackengine.net</em></a><em> on July 30, 2018.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=c132ec2c46a3" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Recommended VSCode extensions for JavaScript]]></title>
            <description><![CDATA[<div class="medium-feed-item"><p class="medium-feed-image"><a href="https://sepineda.medium.com/recommended-vscode-extensions-for-javascript-b7f5f5cc289c?source=rss-6123cfa1286c------2"><img src="https://cdn-images-1.medium.com/max/1950/1*GInmMNJ2ZmQgU43Zq90N5g.jpeg" width="1950"></a></p><p class="medium-feed-snippet">Visual Studio Code (VSCode for short) has become one of the most popular Editor for working with JavaScript, thanks in part to the&#x2026;</p><p class="medium-feed-link"><a href="https://sepineda.medium.com/recommended-vscode-extensions-for-javascript-b7f5f5cc289c?source=rss-6123cfa1286c------2">Continue reading on Medium »</a></p></div>]]></description>
            <link>https://sepineda.medium.com/recommended-vscode-extensions-for-javascript-b7f5f5cc289c?source=rss-6123cfa1286c------2</link>
            <guid isPermaLink="false">https://medium.com/p/b7f5f5cc289c</guid>
            <category><![CDATA[vscode]]></category>
            <category><![CDATA[programming]]></category>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[html]]></category>
            <category><![CDATA[es6]]></category>
            <dc:creator><![CDATA[Eduardo Pineda]]></dc:creator>
            <pubDate>Thu, 05 Jul 2018 21:53:20 GMT</pubDate>
            <atom:updated>2018-07-05T21:55:43.695Z</atom:updated>
        </item>
        <item>
            <title><![CDATA[Top Udemy courses for Learning React]]></title>
            <description><![CDATA[<div class="medium-feed-item"><p class="medium-feed-image"><a href="https://sepineda.medium.com/top-udemy-courses-for-learning-react-9a95e3fa0c45?source=rss-6123cfa1286c------2"><img src="https://cdn-images-1.medium.com/max/1950/1*kEWWI2SPK2oK53hZR-xXDQ.jpeg" width="1950"></a></p><p class="medium-feed-snippet">Udemy is one of my favorite online platform for learning resources. It contains thousands of courses from professionals, experts in a&#x2026;</p><p class="medium-feed-link"><a href="https://sepineda.medium.com/top-udemy-courses-for-learning-react-9a95e3fa0c45?source=rss-6123cfa1286c------2">Continue reading on Medium »</a></p></div>]]></description>
            <link>https://sepineda.medium.com/top-udemy-courses-for-learning-react-9a95e3fa0c45?source=rss-6123cfa1286c------2</link>
            <guid isPermaLink="false">https://medium.com/p/9a95e3fa0c45</guid>
            <category><![CDATA[react]]></category>
            <category><![CDATA[udemy]]></category>
            <category><![CDATA[redux]]></category>
            <category><![CDATA[react-native]]></category>
            <category><![CDATA[javascript]]></category>
            <dc:creator><![CDATA[Eduardo Pineda]]></dc:creator>
            <pubDate>Thu, 24 May 2018 13:32:44 GMT</pubDate>
            <atom:updated>2018-05-26T22:27:44.511Z</atom:updated>
        </item>
        <item>
            <title><![CDATA[How to create a project with Sails.js, webpack and React. Part 2]]></title>
            <link>https://sepineda.medium.com/how-to-create-a-project-with-sails-js-webpack-and-react-part-2-def3cd78c330?source=rss-6123cfa1286c------2</link>
            <guid isPermaLink="false">https://medium.com/p/def3cd78c330</guid>
            <category><![CDATA[sailsjs]]></category>
            <category><![CDATA[react-router]]></category>
            <category><![CDATA[bootstrap]]></category>
            <category><![CDATA[react]]></category>
            <category><![CDATA[javascript]]></category>
            <dc:creator><![CDATA[Eduardo Pineda]]></dc:creator>
            <pubDate>Thu, 17 May 2018 14:20:37 GMT</pubDate>
            <atom:updated>2018-05-17T15:38:06.056Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*aGbIy6NNusEy5wl7OxPUBg.jpeg" /></figure><p>In the previous <a href="http://fullstackengine.net/creating-a-new-project-with-react-and-sails-js/">part of this guide</a>, we made a starter project or template for new projects, integrating some of the most popular and powerful frameworks for web development in the Node.js realm: <a href="https://sailsjs.com/">Sails.js</a>, <a href="https://reactjs.org/">React</a> and <a href="https://webpack.js.org/">Webpack</a>.</p><h3>What this project includes</h3><p>We’ll continue this guide adding a new feature to our starter project, with the use of a client-side router, for which I’ve chosen <a href="https://reacttraining.com/react-router/">react-router</a> given its popularity and long release history. We’ll learn how to make react-router works along with the server side router provided by Sails.js.</p><p>On the other hand, we include <a href="https://getbootstrap.com/">bootstrap</a> (version 4) as our styling frameworks, which is one of the most popular UI frameworks in the React world and has a lot of components and functionalities for our web applications.</p><p>Finally, unless not strictly necessary, we’ll include <a href="https://reactstrap.github.io/">reacstrap</a>, a library with several ready-to-use react components with bootstrap 4 styles, that saves us time and reduces the amount of HTML needed code.</p><p>Let’s recap the agenda for this guide:</p><ol><li><a href="http://fullstackengine.net/creating-a-new-project-with-react-and-sails-js/"><strong>Part 1</strong></a><strong>: Basic project setup with Sails.js v 1.0 (back-end), React 16 (front-end lib) and webpack 4 (as the module loader/bundler).</strong></li><li><strong>(*) Part 2: Project setup adding bootstrap (4) for UI styling along with the use of reactstrap, react-router for client-side routing/history and jest/enzyme for basic testing.</strong></li></ol><p>You can find the complete project’s template source <a href="https://github.com/sepineda/sails-react-webpack">here (part-2)</a>.</p><h3>Before we start…</h3><p>We’ll take the starter project created in <a href="https://github.com/sepineda/sails-react-webpack">part-1</a> as the start point and continue from there setting up our application.</p><p>As we’re using webpack as the bundler for the client libraries, we can get rid of the folder tasks that comes with the sails-cli generator. This folder contains the tasks related to copying, uglifying, transpiling and others that rely upon default on grunt in a typical Sails.js new project, however, webpack replaces all of its functionalities, so is safe to delete it.</p><p>We can also clean our project structure a bit more, by renaming assets as client, I believe this a more appropriate name, as it contains the code for the client side of the project. After that, we can delete all folders inside the client, except js, as we won&#39;t need them for now. Of course, we can add them later as we need to include images, styles or other assets.</p><p>Without more delays, let’s begin,</p><h3>Add and configure React</h3><p>After some cleaning, it’s time to start adding the first library: React. We do this by running,</p><p>npm install --save react react-dom</p><p>We’ll also need babel presets for react-16, in order to transpile es6 and jsx code to basic es5 (the most widely support javascript specification by browsers) properly,</p><p>npm install --save-dev babel-preset-env babel-preset-react babel-preset-react-hmre,</p><p>Then, modify .babelrc to set up these presets,</p><pre>{<br>  &quot;presets&quot;: [&quot;es2015&quot;, &quot;react&quot;],<br>  &quot;plugins&quot;: [<br>    &quot;transform-object-rest-spread&quot;,<br>    &quot;transform-class-properties&quot;<br>  ],<br>  &quot;env&quot;: {<br>    &quot;development&quot;: {<br>      &quot;presets&quot;: [&quot;react-hmre&quot;]<br>    }<br>  }<br>}</pre><h3>Webpack environments and webpack-dev-server</h3><p>Now, it’s time to configure webpack to bundle and load React js code, but we’ll also make use of a cool feature called <a href="https://github.com/webpack/webpack-dev-server">webpack-dev-server</a> that reloads the application in real-time, when any change to the code is made, turning our development experience in a more satisfying and agile oriented one.</p><p>Let’s add some libraries to support hot-reload feature along with the dev-server,</p><p>npm install --save-dev webpack-dev-server webpack-hot-middleware opn</p><p>As we only need webpack-dev-server in the development phase, let’s add a webpack configuration file for dev only,</p><pre>import webpack from &#39;webpack&#39;;<br><br>const HtmlWebpackPlugin = require(&#39;html-webpack-plugin&#39;);<br>const precss = require(&#39;precss&#39;);<br>const autoprefixer = require(&#39;autoprefixer&#39;);<br>const path = require(&#39;path&#39;);<br><br>module.exports = {<br>  devtool: &#39;source-map&#39;,<br>  entry: [<br>    &#39;./client/js/index.js&#39;,<br>    &#39;webpack-hot-middleware/client?reload=true&#39;<br>  ],<br>  output: {<br>    path: path.join(__dirname, &#39;/.tmp/public&#39;),<br>    filename: &#39;bundle.js&#39;,<br>    publicPath: &#39;/&#39;<br>  },<br>  module: {<br>    rules: [<br>      {<br>        use: &#39;babel-loader&#39;,<br>        test: /\.js$/,<br>        exclude: /node_modules/<br>      },<br>      {<br>        use: [&#39;style-loader&#39;, &#39;css-loader&#39;],<br>        test: /\.css$/<br>      },<br>      {<br>        test: /\.(scss)$/,<br>        use: [{<br>          loader: &#39;style-loader&#39; // inject CSS to page<br>        }, {<br>          loader: &#39;css-loader&#39; // translates CSS into CommonJS modules<br>        }, {<br>          loader: &#39;postcss-loader&#39;, // Run post css actions<br>          options: {<br>            plugins: () =&gt; // post css plugins, can be exported to postcss.config.js<br>              [<br>                precss,<br>                autoprefixer<br>              ]<br>          }<br>        }, {<br>          loader: &#39;sass-loader&#39; // compiles Sass to CSS<br>        }]<br>      }<br>    ]<br>  },<br><br>  plugins: [<br>    new HtmlWebpackPlugin({<br>      template: &#39;client/index.html&#39;<br>    }),<br>    new webpack.HotModuleReplacementPlugin()<br>  ]<br>};</pre><p>The main difference from the original webpack.config.js is the use webpack-hot-middleware to reload the server every time a change happens, and the line devtool: &#39;source-map&#39;, that let us inspect the source code, without being transpile, as we see it in our code editor. The following screenshot shows it in action,</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/318/0*wFJ9rDlUFaextY2K.png" /></figure><h3>Web Server</h3><p>Maybe you’re wondering that if webpack has its own server, then what happens to Sails.js, isn’t it supposed to work as the web server to accept requests from the client side?. Well, it’s definitely the server in the production environment. But in development, we need a mean to get both working together, for this reason, we’ll add a new folder called tools and inside it a file dev.js,</p><pre>import opn from &#39;opn&#39;;<br>import path from &#39;path&#39;;<br>import webpack from &#39;webpack&#39;;<br>import WebpackDevServer from &#39;webpack-dev-server&#39;;<br><br>import webpackConfig from &#39;../webpack.config.dev&#39;;<br><br>const compiler = webpack(webpackConfig);<br><br>const serverConfig = {<br>  contentBase: path.resolve(__dirname, &#39;../client&#39;),<br>  hot: true,<br>  inline: true,<br>  stats: {<br>    colors: true<br>  },<br>  publicPath: webpackConfig.output.publicPath,<br>  historyApiFallback: true,<br>  proxy: {<br>    &#39;/api/*&#39;: &#39;http://localhost:1337&#39;<br>  },<br>  headers: {<br>    &#39;Cache-Control&#39;: &#39;no-cache, no-store, must-revalidate&#39;,<br>    Pragma: &#39;no-cache&#39;,<br>    Expires: &#39;-1&#39;,<br>    &#39;X-Frame-Options&#39;: &#39;SAMEORIGIN&#39;<br>  }<br>};<br><br>const server = new WebpackDevServer(compiler, serverConfig);<br><br>server.use(require(&#39;webpack-hot-middleware&#39;)(compiler));<br><br>const host = &#39;localhost&#39;;<br>const port = 8080;<br><br>server.listen(port, host, (err) =&gt; {<br>  if (err) {<br>    console.log(&#39;[webpack-dev-server] failed to start: &#39;, err);<br>  } else {<br>    const protocol = &#39;http&#39;;<br>    const openHost = host;<br>    const suffix = webpackConfig.output.publicPath;<br>    const openURL = `${protocol}://${openHost}:${port}/webpack-dev-server${suffix}`;<br><br>    const openMsg = `[webpack-dev-server] started: opening the app: ${openURL}`;<br>    console.log(openMsg);<br>    opn(openURL);<br>  }<br>});<br><br>server.app.get(&#39;/reload&#39;, (req, res) =&gt; {<br>  // Tell connected browsers to reload.<br>  server.sockWrite(server.sockets, &#39;ok&#39;);<br>  res.sendStatus(200);<br>});<br><br>server.app.get(&#39;/invalid&#39;, (req, res) =&gt; {<br>  // Tell connected browsers some change is about to happen.<br>  server.sockWrite(server.sockets, &#39;invalid&#39;);<br>  res.sendStatus(200);<br>});</pre><p>As you might know, Sails works on top of another framework, a pillar in the MEAN stack, Express.js. Here we make use of it and the webpack dev server API for Node.js. Basically, we take the configuration from webpack.config.dev.js, set a proxy for the web API listening at port 1334 (we&#39;ll see how this work in the next part) and then set the server listening for regular requests at port 8080. As the final step, we use the utility lib opn to launch the web page in the browser automatically for us.</p><p>Now, we can add a script in package.json to run this script inside dev.js in a single step, using babel-cli as follows,</p><pre>&quot;scripts&quot;: {<br>  ...<br>  &quot;open:client&quot;: &quot;babel-node tools/dev.js&quot;,<br>  ...<br>}</pre><h3>React &amp; Sails Router</h3><p>Getting back to the main app code, we’re going now to set the routing configuration up. This is done in 2 steps, one in the client and the other on the server. Let’s begin with the client, we first need to install React Router for the web, for what we use react-router-dom,</p><p>npm install --save react-router-dom,</p><p>Then, in the index of the app in client/js/index.js we wrap the whole component inside a &lt;BrowserRouter&gt; tag, so all the components bellow share a common context for the different routes we add.</p><p>Next, we define landing page (LandingPage.js, we wrap the whole component inside a &lt;BrowserRouter&gt; tag, so all the components bellow shares a common context for the different routes we add.<br> Thus, we implement the navigation feature with the buttons to go to the different sections of the page, we&#39;ll name them as Home, Contact and More.</p><pre>import React from &#39;react&#39;;<br>import { BrowserRouter as Router, Route } from &#39;react-router-dom&#39;;<br>import NavBar from &#39;./navbar/Navbar&#39;;<br>import Home from &#39;./home/Home&#39;;<br>import Contact from &#39;./contact/Contact&#39;;<br>import More from &#39;./more/More&#39;;<br><br>export default function LandingPage() {<br>  return (<br>    &lt;Router&gt;<br>      &lt;div&gt;<br>        &lt;NavBar /&gt;<br>        &lt;main&gt;<br>          &lt;Route exact path=&quot;/&quot; component={Home} /&gt;<br>          &lt;Route path=&quot;/home&quot; component={Home} /&gt;<br>          &lt;Route path=&quot;/contact&quot; component={Contact} /&gt;<br>          &lt;Route path=&quot;/more&quot; component={More} /&gt;<br>        &lt;/main&gt;<br>      &lt;/div&gt;<br>    &lt;/Router&gt;<br>  );<br>}</pre><p>We’ll define these components in the next section, but before that, we need to tell Sails how to respond to requests that belong to routes in react and not for the server, for example the user might enter <a href="http://my-react-app.com/home">http://my-react-app.com/home</a>, where /home is not a resource in the server, but an in the client side, and its the task of react-router to respond rendering the corresponding JSX/HTML segment in the current page.</p><h3>Sails Routes/Controller</h3><p>First, go to config/routes.js and change the lines containing the following code:</p><pre>&#39;/&#39;: {<br>  view: &#39;pages/homepage&#39;<br>},</pre><p>to this:</p><pre>&#39;/*&#39;: {<br>    controller: &#39;IndexController&#39;,<br>    action: &#39;render&#39;,<br>    skipAssets: true<br>  }</pre><p>For all the requests coming from the browser, the server will respond with the render action in the IndexController. So let’s define the IndexController, we can easily create a new one by typing into the command line,</p><p>sails generate controller Index</p><p>Then, go to api/controllers/IndexController.js and write the render action,</p><pre>/**<br> * IndexController<br> *<br> * @description :: Server-side actions for handling incoming requests.<br> * @help        :: See https://sailsjs.com/docs/concepts/actions<br> */<br><br>module.exports = {<br>  render: (req, res) =&gt; res.view(&#39;pages/homepage&#39;)<br>};</pre><p>Now the server will respond to any request from the browser with the same contents from homepage.ejs, where react-router lives. That&#39;s exactly what we&#39;re looking for to get the navigation working as expected.</p><h3>Bootstrap and Reactstrap</h3><p>Last, but not least, it’s time to define the visual components of our starter app. Let’s begin with &lt;Navbar&gt;. Create a new folder in client/components/navbar and inside it a new file Navbar.js,</p><pre>import React, { Component } from &#39;react&#39;;<br>import {<br>  Collapse,<br>  Navbar,<br>  NavbarToggler,<br>  NavbarBrand,<br>  Nav,<br>  NavItem<br>} from &#39;reactstrap&#39;;<br>import { Link } from &#39;react-router-dom&#39;;<br><br>export default class NavBar extends Component {<br>  constructor(props) {<br>    super(props);<br><br>    this.toggle = this.toggle.bind(this);<br>    this.state = {<br>      isOpen: false<br>    };<br>  }<br>  toggle() {<br>    this.setState({<br>      isOpen: !this.state.isOpen<br>    });<br>  }<br>  render() {<br>    return (<br>      &lt;div&gt;<br>        &lt;Navbar color=&quot;light&quot; light expand=&quot;md&quot;&gt;<br>          &lt;NavbarBrand href=&quot;/&quot;&gt;Sails React starter&lt;/NavbarBrand&gt;<br>          &lt;NavbarToggler onClick={this.toggle} /&gt;<br>          &lt;Collapse isOpen={this.state.isOpen} navbar&gt;<br>            &lt;Nav className=&quot;mr-auto&quot; navbar&gt;<br>              &lt;NavItem&gt;<br>                &lt;Link className=&quot;nav-link&quot; to=&quot;/home&quot;&gt;Home&lt;/Link&gt;<br>              &lt;/NavItem&gt;<br>              &lt;NavItem&gt;<br>                &lt;Link className=&quot;nav-link&quot; to=&quot;/contact&quot;&gt;Contact&lt;/Link&gt;<br>              &lt;/NavItem&gt;<br>              &lt;NavItem&gt;<br>              &lt;Link className=&quot;nav-link&quot; to=&quot;/more&quot;&gt;More...&lt;/Link&gt;<br>              &lt;/NavItem&gt;<br>            &lt;/Nav&gt;<br>          &lt;/Collapse&gt;<br>        &lt;/Navbar&gt;<br>      &lt;/div&gt;<br>    );<br>  }<br>}</pre><p>This component shows a nancy navbar with a toggle button for expanding menus on small screens. And also includes a key component to get the routes working as we want them to do. Instead of adding anchors with href properties, pointing directly to the route paths, we use a &lt;Link&gt; component from react-router-dom, with a property called to, that contains the route path.<br> If you inspect any of the &lt;NavItem&gt;&#39;s in the browser, you&#39;ll see they render into a simple anchor with a href property pointing to the route path, however, internally there is a event handler that catch this request and sends it to react-router instead of sending it to the server. So there is no HTTP request/response and page refresh.</p><p>Finally, let’s add the components for Home, Contact and More. We’ll use almost the same JSX template for the three of them. So, for simplicity, I’ll show the code only for &lt;Home&gt; (client/components/home/Home.js),</p><pre>import React from &#39;react&#39;;<br>import { Jumbotron, Button } from &#39;reactstrap&#39;;<br><br>const Home = () =&gt; (<br>    &lt;div&gt;<br>      &lt;Jumbotron&gt;<br>        &lt;h1 className=&quot;display-3&quot;&gt;Hello, world!&lt;/h1&gt;<br>        &lt;p className=&quot;lead&quot;&gt;<br>          This is a simple hero unit, a simple Jumbotron-style component for calling extra attention<br>          to featured content or information.<br>        &lt;/p&gt;<br>        &lt;hr className=&quot;my-2&quot; /&gt;<br>        &lt;p&gt;<br>          It uses utility classes for typgraphy and spacing to space content out within the larger<br>          container.<br>        &lt;/p&gt;<br>        &lt;p className=&quot;lead&quot;&gt;<br>          &lt;Button color=&quot;primary&quot;&gt;Learn More&lt;/Button&gt;<br>        &lt;/p&gt;<br>      &lt;/Jumbotron&gt;<br>    &lt;/div&gt;<br>);<br><br>export default Home;</pre><p>And that’s it. We are ready to run the application!.</p><p>We can start running the project in development mode, with the command,</p><p>npm run start</p><p>You can find the complete list of scripts, including build, debug, clean and others in package.json.</p><h3>Coming up next</h3><p>Thank you so much for reading this article!. I would like to include all of the contents in this second part, however, I didn’t want to make it longer than necessary for a good reading experience. For this reason, I’ll continue with Unit Testing using Jest and Enzyme, and manage the app’s state with Redux in the next part.</p><p>Again, thank you for your interest in this blog. Take care and talk to you soon. Regards!.</p><p><em>Originally published at </em><a href="http://fullstackengine.net/new-project-react-sails-part2/"><em>fullstackengine.net</em></a><em> on May 17, 2018.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=def3cd78c330" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Recommended VSCode extensions for React]]></title>
            <description><![CDATA[<div class="medium-feed-item"><p class="medium-feed-image"><a href="https://sepineda.medium.com/recommended-vscode-extensions-for-react-f1bcaeb631d2?source=rss-6123cfa1286c------2"><img src="https://cdn-images-1.medium.com/max/1350/1*47XyuGpb3QSAQJCaZgUFdw.jpeg" width="1350"></a></p><p class="medium-feed-snippet">In two previous posts, I gave you my recommended extensions (packages) for Atom to work with Angular, and to work with React. Time has&#x2026;</p><p class="medium-feed-link"><a href="https://sepineda.medium.com/recommended-vscode-extensions-for-react-f1bcaeb631d2?source=rss-6123cfa1286c------2">Continue reading on Medium »</a></p></div>]]></description>
            <link>https://sepineda.medium.com/recommended-vscode-extensions-for-react-f1bcaeb631d2?source=rss-6123cfa1286c------2</link>
            <guid isPermaLink="false">https://medium.com/p/f1bcaeb631d2</guid>
            <category><![CDATA[software-engineering]]></category>
            <category><![CDATA[programming]]></category>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[software]]></category>
            <category><![CDATA[react]]></category>
            <dc:creator><![CDATA[Eduardo Pineda]]></dc:creator>
            <pubDate>Wed, 21 Mar 2018 14:40:22 GMT</pubDate>
            <atom:updated>2018-03-22T15:17:29.502Z</atom:updated>
        </item>
    </channel>
</rss>