<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: QCObjects</title>
    <description>The latest articles on DEV Community by QCObjects (@qcobjects).</description>
    <link>https://dev.to/qcobjects</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Forganization%2Fprofile_image%2F842%2F99c813c6-fcbd-4050-9965-8f74e6792330.PNG</url>
      <title>DEV Community: QCObjects</title>
      <link>https://dev.to/qcobjects</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/qcobjects"/>
    <language>en</language>
    <item>
      <title>What is Collab for Data Science?</title>
      <dc:creator>Jean Machuca</dc:creator>
      <pubDate>Wed, 22 Apr 2020 20:47:01 +0000</pubDate>
      <link>https://dev.to/qcobjects/what-is-collab-for-data-science-4g18</link>
      <guid>https://dev.to/qcobjects/what-is-collab-for-data-science-4g18</guid>
      <description>&lt;p&gt;QCObjects Collab for DataScience is an engine that helps the data scientists to automate data processing and collaborative analysis tasks. While a combination of other tools will help you to visualise your data in beautiful charts, Collab for DataScience is focused in analysis, allowing you to write calculus and math of complex scripts for different kind of analysis as well as descriptive, predictive, trend and clustering analysis, that are running server-less and in a shared always-alive context. You can run a script and go home or for a coffee until it ends the task, and your partner can run other micro-data bots in parallel that use the data that your still-running main bot-script is creating on runtime, even if it has not finished yet. &lt;/p&gt;

&lt;p&gt;If you use it in conjunction with QCObjects HTTP2 Built-In Server, you’re empowered to make your own data science APIs quick and easy &lt;/p&gt;

&lt;p&gt;In order to get feedback to complete the product documentation with the features that matters the most, It is still in beta testing stage and it is being distributed as a part of the QCObjects Community Edition for FREE! &lt;/p&gt;

&lt;p&gt;To install it, you can either use the docker image or use npm:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://www.npmjs.com/package/qcobjects-collab"&gt;https://www.npmjs.com/package/qcobjects-collab&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Demo of QCObjects Collab for Data Science &lt;br&gt;
&lt;a href="https://youtu.be/7UnLXEdH1c0"&gt;https://youtu.be/7UnLXEdH1c0&lt;/a&gt;&lt;/p&gt;

</description>
      <category>datascience</category>
      <category>qcobjects</category>
      <category>tools</category>
    </item>
    <item>
      <title>QCObjects Hosting is available into the DigitalOcean Marketplace!</title>
      <dc:creator>Jean Machuca</dc:creator>
      <pubDate>Sat, 07 Dec 2019 20:03:37 +0000</pubDate>
      <link>https://dev.to/qcobjects/qcobjects-hosting-is-available-into-the-digitalocean-marketplace-2k2</link>
      <guid>https://dev.to/qcobjects/qcobjects-hosting-is-available-into-the-digitalocean-marketplace-2k2</guid>
      <description>&lt;p&gt;Here is a good news for all! &lt;/p&gt;

&lt;p&gt;QCObjects is available into the DigitalOcean Marketplace! &lt;/p&gt;

&lt;p&gt;I've been showing a few weeks ago how to make your progressive web apps and accelerated mobile pages in just one step. Well, you can do it as well in your DigitalOcean web hosting!&lt;/p&gt;

&lt;p&gt;Have a look at the live demo here:&lt;br&gt;
&lt;a href="http://www.youtube.com/watch?v=OppmqSunSc0"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--8JyV2-zu--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/http://img.youtube.com/vi/OppmqSunSc0/0.jpg" alt="QCObjects DO Hosting"&gt;&lt;/a&gt;&lt;/p&gt;

</description>
      <category>qcobjects</category>
      <category>javascript</category>
      <category>serverless</category>
    </item>
    <item>
      <title>QCObjects on Amazon Web Services Marketplace!</title>
      <dc:creator>Jean Machuca</dc:creator>
      <pubDate>Sat, 07 Dec 2019 19:54:06 +0000</pubDate>
      <link>https://dev.to/qcobjects/qcobjects-on-amazon-web-services-marketplace-5h4o</link>
      <guid>https://dev.to/qcobjects/qcobjects-on-amazon-web-services-marketplace-5h4o</guid>
      <description>&lt;p&gt;If you got an account in Amazon Web Services I got good news for you! &lt;/p&gt;

&lt;p&gt;Now, QCObjects is fully integrated with AWS so you can create your AMI and Private Image products to develop your high availability PWA and AMP in just one step. QCObjects is an Open Source Framework that allows Full-Stack developers to create create micro-services and micro-frontends into an N-Tier layered architecture based on JavaScript. Thousands of companies are trying QCObjects around the world and saving machine resource costs by coding fancy, clean and quick. QCObjects is available in the most used AWS regions including Free Tier. I invite you to try it and leave a review here: &lt;/p&gt;

&lt;p&gt;&lt;a href="https://aws.amazon.com/marketplace/pp/B07YZRH7VB"&gt;Link on AWS&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--E_2NNfYe--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://thepracticaldev.s3.amazonaws.com/i/lpgemidkl2xi36y3al23.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--E_2NNfYe--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://thepracticaldev.s3.amazonaws.com/i/lpgemidkl2xi36y3al23.png" alt="Alt Text"&gt;&lt;/a&gt;&lt;/p&gt;

</description>
      <category>qcobjects</category>
      <category>aws</category>
      <category>linux</category>
      <category>ubuntu</category>
    </item>
    <item>
      <title>Making a GraphQL Micro-service with QCObjects HTTP2 Built-In Server</title>
      <dc:creator>Jean Machuca</dc:creator>
      <pubDate>Sat, 07 Dec 2019 19:41:16 +0000</pubDate>
      <link>https://dev.to/qcobjects/making-a-graphql-micro-service-with-qcobjects-http2-built-in-server-1ge8</link>
      <guid>https://dev.to/qcobjects/making-a-graphql-micro-service-with-qcobjects-http2-built-in-server-1ge8</guid>
      <description>&lt;p&gt;In the following step-by-step tutorial I'll show you how to make a fancy, clean and quick micro-service using QCObjects HTTP2 Built-In Server and GraphQL &lt;/p&gt;

&lt;p&gt;If you want to know more about GraphQL go to &lt;a href="https://graphql.org"&gt;https://graphql.org&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;If you want to learn more about QCObjects go to &lt;a href="https://qcobjects.dev"&gt;https://qcobjects.dev&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;1.- Create a progressive web app using the command line of QCObjects CLI Tool (you should be inside the project's folder):&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt; qcobjects create &lt;span class="nt"&gt;--pwa&lt;/span&gt; mynewmicroservice
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;2.- Install GraphQL inside the project's folder:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt; npm &lt;span class="nb"&gt;install &lt;/span&gt;graphql &lt;span class="nt"&gt;--save&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;3.- Create/Edit a config.json file inside the project's folder&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt; vi config.json
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;4.- In the new config.json file add the following lines:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight json"&gt;&lt;code&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"relativeImportPath"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"js/packages/"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"domain"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"0.0.0.0"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"backend"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="nl"&gt;"routes"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;[{&lt;/span&gt;&lt;span class="w"&gt;
      &lt;/span&gt;&lt;span class="nl"&gt;"path"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"/helloworld"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
      &lt;/span&gt;&lt;span class="nl"&gt;"microservice"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"org.quickcorp.custom.backend.helloworld"&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="p"&gt;}]&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;5.- Then create/edit a new package inside the js/packages folder:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt; vi js/packages/org.quickcorp.custom.backend.helloworld.js
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;6.- The following animation shows the basic code of a Microservice using GraphQL and QCObjects HTTP2 Built-In Server &lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--rT2ibADb--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_66%2Cw_880/https://cdn.hashnode.com/res/hashnode/image/upload/v1575682660790/4myNi0KFu.gif" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--rT2ibADb--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_66%2Cw_880/https://cdn.hashnode.com/res/hashnode/image/upload/v1575682660790/4myNi0KFu.gif" alt="QCOBJECTS GRAPHQL Microservice Code.gif"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;7.- Launch the QCObjects HTTP2 Built-In Server using the following command line:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt; qcobjects launch mynewmicroservice
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;8.- Then open a browser in the address &lt;a href="https://127.0.0.1/helloworld"&gt;https://127.0.0.1/helloworld&lt;/a&gt; and you should see a result like this:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--Wc90ptNx--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn.hashnode.com/res/hashnode/image/upload/v1575747441007/TriqW76r8.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--Wc90ptNx--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn.hashnode.com/res/hashnode/image/upload/v1575747441007/TriqW76r8.png" alt="QCObjects GraphQL Microservice Result.png"&gt;&lt;/a&gt;&lt;/p&gt;

</description>
      <category>qcobjects</category>
      <category>javascript</category>
      <category>microservices</category>
      <category>graphql</category>
    </item>
    <item>
      <title>Accelerated Mobile Pages with QCObjects</title>
      <dc:creator>Jean Machuca</dc:creator>
      <pubDate>Tue, 11 Jun 2019 04:07:53 +0000</pubDate>
      <link>https://dev.to/qcobjects/accelerated-mobile-pages-with-qcobjects-4l5i</link>
      <guid>https://dev.to/qcobjects/accelerated-mobile-pages-with-qcobjects-4l5i</guid>
      <description>&lt;p&gt;AMP is a web component framework to easily create user-first websites.&lt;/p&gt;

&lt;p&gt;QCObjects integrates many tools in a securer, faster and easier to learn runtime components scope, so why not use it to make a compelling accelerated mobile page that also can be designed into an N-Tier architecture, and all of this using pure javascript?&lt;/p&gt;

&lt;p&gt;Added value that can QCObjects bring to AMP:&lt;/p&gt;

&lt;p&gt;Organised Code Structure, Fast Rendering, Friendly syntax , Config Secure encryption , Simultaneous animation effects , Dynamic storage cache control , Components tree architecture , Runtime stacked components and...&lt;/p&gt;

&lt;p&gt;Easy and short steps:&lt;/p&gt;

&lt;p&gt;To make your first AMP application using QCObjects you only need to type this in your console:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt; npm i qcobjects-cli
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;Then, create a directory for your app and enter it:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt; &lt;span class="nb"&gt;mkdir &lt;/span&gt;mynewapp &lt;span class="o"&gt;&amp;amp;&amp;amp;&lt;/span&gt; &lt;span class="nb"&gt;cd &lt;/span&gt;mynewapp 
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;Finally, generate the new AMP template using the cli tool&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt; &lt;span class="nb"&gt;sudo &lt;/span&gt;qcobjects create mynewapp &lt;span class="nt"&gt;--amp&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;Done.&lt;/p&gt;

&lt;p&gt;2.- Serving over HTTP2&lt;/p&gt;

&lt;p&gt;Once you've created your application, you can serve it using the qcobjects-server tool installed with the cli tool. Go to the app directory and type:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt; qcobjects-server 
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;and press enter.&lt;/p&gt;

&lt;p&gt;Then, go to a web browser and navigate to: &lt;/p&gt;

&lt;p&gt;&lt;a href="https://localhost"&gt;https://localhost&lt;/a&gt; &lt;/p&gt;

&lt;p&gt;Here is the complete example:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--Zk5yT8UN--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_66%2Cw_880/https://qcobjects.dev/doc/img/QCObjects-CLI-AMP.gif" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--Zk5yT8UN--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_66%2Cw_880/https://qcobjects.dev/doc/img/QCObjects-CLI-AMP.gif" alt="qcobjects-amp"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Please let me know how to improve this article in a comment!&lt;/p&gt;

&lt;p&gt;Cheers!&lt;/p&gt;

</description>
      <category>amp</category>
      <category>javascript</category>
      <category>qcobjects</category>
      <category>uiweekly</category>
    </item>
    <item>
      <title>Progressive Web Apps With QCObjects</title>
      <dc:creator>Jean Machuca</dc:creator>
      <pubDate>Sun, 09 Jun 2019 06:57:47 +0000</pubDate>
      <link>https://dev.to/qcobjects/progressive-web-apps-with-qcobjects-30pl</link>
      <guid>https://dev.to/qcobjects/progressive-web-apps-with-qcobjects-30pl</guid>
      <description>&lt;p&gt;Web apps development is in huge demand. Learning curve is becoming too steep. Developers are facing the challenge to be faster than ever producing good quality code. &lt;/p&gt;

&lt;p&gt;And even now, despite of the growth of device native apps itself, a conventional thinking that a web app "must be like" a native app had become more and more accepted by the community. That's why progressive web apps do exist.&lt;/p&gt;

&lt;p&gt;QCObjects integrates many tools in a securer, faster and easier to learn runtime components scope, so why not use it to make a compelling progressive web app that also can be designed into an N-Tier architecture, and all of this using pure javascript?&lt;/p&gt;

&lt;p&gt;Look, if you want to make a professional web application, you need to first think about these three basic concerns:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Performance &lt;/li&gt;
&lt;li&gt;Accessibility &lt;/li&gt;
&lt;li&gt;Best Practices&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;So, let's talk about performance:&lt;/p&gt;

&lt;p&gt;Browser engineers recommend pages contain fewer than ~1,500 DOM nodes. The sweet spot is a tree depth &amp;lt; 32 elements and fewer than 60 children/parent element. A large DOM can increase memory usage, cause longer style calculations, and produce costly layout reflows. Learn more about this &lt;a href="https://developers.google.com/web/tools/lighthouse/audits/dom-size"&gt;here&lt;/a&gt;.&lt;br&gt;
QCObjects was designed thinking in this. That's why you can append an object into the DOM tree making possible to rebuild nested components on the fly. This will reduce considerably the depth of DOM nodes in your PWA.&lt;/p&gt;

&lt;p&gt;To increase performance, you can code a service worker that uses the cache api to work offline instead of fetching the content again and again. QCObjects makes the service worker registration at the load of the PWA, you only need to specify the service worker uri by typing the corresponding CONFIG set. &lt;/p&gt;

&lt;p&gt;To increase the performance even more, QCObjects has a Complex Cache Control that allows you to save any object "stringified" to the localStorage and get it back. Components had a built-in cache control based on that complex cache control so you can either leave QCObjects to use cache for all components (Components.cached=true), or set cached property independently for every single component instance.&lt;/p&gt;

&lt;p&gt;What about accessibility?&lt;/p&gt;

&lt;p&gt;To make your professional PWA accessible, sometimes you need to repeat a lot of code. With QCObjects you can organise your code into components that are loaded in your PWA in runtime. Every component has an isolated building behavior, so you can build and load a component outside the DOM, but even after you do that, you can append the body of a component into the DOM using the append method that QCObjects has injected  into the DOM prototype. For example: by this way, you can make a component that contains the PWA information meta tags once filling it with dynamic data. This will make you happy when you want to save the meta information in a server to make changes to a bunch of apps that are already published and you don't want to make a new version only to change the app description.&lt;/p&gt;

&lt;p&gt;OK, let's go ahead an do the best practices: &lt;/p&gt;

&lt;p&gt;1.- Using a good layout. &lt;/p&gt;

&lt;p&gt;With QCObjects you can use any of the most famous CSS3 frameworks to bootstrap your web design. But then, you want to make your own customisations. For that, you can use SourceCSS QCObjects class, that is very useful to import a CSS file in the head of the document "dynamically".&lt;/p&gt;

&lt;p&gt;1.- Creating your first application&lt;/p&gt;

&lt;p&gt;To make your first PWA application using QCObjects you only need to type this in your console:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt; npm i qcobjects-cli
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;Then, create a directory for your app and enter it:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt; &lt;span class="nb"&gt;mkdir &lt;/span&gt;mynewapp &lt;span class="o"&gt;&amp;amp;&amp;amp;&lt;/span&gt; &lt;span class="nb"&gt;cd &lt;/span&gt;mynewapp 
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;Finally, generate the new app template using the cli tool&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt; &lt;span class="nb"&gt;sudo &lt;/span&gt;qcobjects create mynewapp &lt;span class="nt"&gt;--pwa&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;Done.&lt;/p&gt;

&lt;p&gt;2.- Serving over HTTP2&lt;/p&gt;

&lt;p&gt;Once you've created your application, you can serve it using the qcobjects-server tool installed with the cli tool. Go to the app directory and type:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt; qcobjects-server 
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;and press enter.&lt;/p&gt;

&lt;p&gt;Then, go to a web browser and navigate to: &lt;/p&gt;

&lt;p&gt;&lt;a href="https://localhost"&gt;https://localhost&lt;/a&gt; &lt;/p&gt;

&lt;p&gt;3.- Registering a service worker:&lt;/p&gt;

&lt;p&gt;To register a service worker using QCObjects you only need to specify the CONFIG setting. In your init.js , put the following line:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight javascript"&gt;&lt;code&gt;        &lt;span class="nx"&gt;CONFIG&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="kd"&gt;set&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;serviceWorkerURI&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;/sw.js&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;This means QCObjects will look for /sw.js in the root directory of your app and will register as a service worker. You can use navigator.serviceWorker.ready.then(...) to attach any code after the service worker is loaded.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="nb"&gt;navigator&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;serviceWorker&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;ready&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;then&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="p"&gt;(){&lt;/span&gt;
   &lt;span class="nx"&gt;logger&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;info&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;service worker is done&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="p"&gt;})&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;5.- Adding push notifications:&lt;/p&gt;

&lt;p&gt;Adapting the official code of &lt;a href="https://developer.mozilla.org/en-US/docs/Web/API/PushManager#Example"&gt;Mozilla&lt;/a&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight javascript"&gt;&lt;code&gt;  &lt;span class="nx"&gt;Class&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;PushNotifications&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="nx"&gt;InheritClass&lt;/span&gt;&lt;span class="p"&gt;,{&lt;/span&gt;
    &lt;span class="na"&gt;_new_&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="p"&gt;(){&lt;/span&gt;
      &lt;span class="nb"&gt;window&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;onpush&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="kd"&gt;function&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;event&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="nx"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;event&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;data&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
        &lt;span class="c1"&gt;// From here we can write the data to IndexedDB, send it to any open&lt;/span&gt;
        &lt;span class="c1"&gt;// windows, display a notification, etc.&lt;/span&gt;
      &lt;span class="p"&gt;}&lt;/span&gt;

      &lt;span class="nb"&gt;navigator&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;serviceWorker&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;ready&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;then&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
        &lt;span class="kd"&gt;function&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;serviceWorkerRegistration&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
          &lt;span class="nx"&gt;serviceWorkerRegistration&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;pushManager&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;subscribe&lt;/span&gt;&lt;span class="p"&gt;().&lt;/span&gt;&lt;span class="nx"&gt;then&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
            &lt;span class="kd"&gt;function&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;pushSubscription&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
              &lt;span class="nx"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;pushSubscription&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;endpoint&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
              &lt;span class="c1"&gt;// The push subscription details needed by the application&lt;/span&gt;
              &lt;span class="c1"&gt;// server are now available, and can be sent to it using,&lt;/span&gt;
              &lt;span class="c1"&gt;// for example, an XMLHttpRequest.&lt;/span&gt;
            &lt;span class="p"&gt;},&lt;/span&gt; &lt;span class="kd"&gt;function&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;error&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
              &lt;span class="c1"&gt;// During development it often helps to log errors to the&lt;/span&gt;
              &lt;span class="c1"&gt;// console. In a production environment it might make sense to&lt;/span&gt;
              &lt;span class="c1"&gt;// also report information about errors back to the&lt;/span&gt;
              &lt;span class="c1"&gt;// application server.&lt;/span&gt;
              &lt;span class="nx"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;error&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
            &lt;span class="p"&gt;}&lt;/span&gt;
          &lt;span class="p"&gt;);&lt;/span&gt;
        &lt;span class="p"&gt;});&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;
  &lt;span class="p"&gt;})&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;To activate this class, use the following:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="kd"&gt;let&lt;/span&gt; &lt;span class="nx"&gt;pushNotifications&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;New&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;PushNotifications&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;Please let me know how to improve this article in a comment!&lt;/p&gt;

&lt;p&gt;Cheers!&lt;/p&gt;

</description>
      <category>qcobjects</category>
      <category>javascript</category>
      <category>beginners</category>
    </item>
  </channel>
</rss>
