{"id":592,"date":"2024-06-16T09:02:37","date_gmt":"2024-06-16T09:02:37","guid":{"rendered":"https:\/\/zalvis.com\/docs\/?p=592"},"modified":"2024-06-16T09:02:37","modified_gmt":"2024-06-16T09:02:37","slug":"using-nodejs-apps","status":"publish","type":"post","link":"https:\/\/zalvis.com\/docs\/using-nodejs-apps.html","title":{"rendered":"Using NodeJS Apps"},"content":{"rendered":"<p>cPanel can run NodeJs applications. NodeJs was created with the aim to create real-time sites with push capability, and the creators got their inspiration from applications like Gmail. We finally have web applications with two-way connections, where both the server and the client can initiate communication, allowing them to freely exchange data.<\/p>\n<p>To load your first configuration screen, log into cPanel and then click Setup Node.Js App.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-593\" src=\"https:\/\/zalvis.com\/docs\/wp-content\/uploads\/2024\/06\/IMG_8234.png\" alt=\"\" width=\"1292\" height=\"496\" srcset=\"https:\/\/zalvis.com\/docs\/wp-content\/uploads\/2024\/06\/IMG_8234.png 1292w, https:\/\/zalvis.com\/docs\/wp-content\/uploads\/2024\/06\/IMG_8234-300x115.png 300w, https:\/\/zalvis.com\/docs\/wp-content\/uploads\/2024\/06\/IMG_8234-1024x393.png 1024w, https:\/\/zalvis.com\/docs\/wp-content\/uploads\/2024\/06\/IMG_8234-768x295.png 768w\" sizes=\"auto, (max-width: 1292px) 100vw, 1292px\" \/><\/p>\n<p>In order to set up a NodeJS application, you will need to fill out three fields. The folder from which all of the NodeJS files will be loaded is the Application root. Any module imports will fail if this field isn\u2019t correct. The URL from which you would like the website to be loaded from is the Application URL.<\/p>\n<p>The main entry point of your NodeJs application is the Application startup file. Typically, this is the file that has a listening HTTP server on a specific port and has all of the data connectivity string, module imports, and so on. The application will be proxied accordingly if you\u2019ve done everything right, and it will be available on ports 443 and 80.<\/p>\n<p>Your error log location should be in the passenger log file field. However, you can set it to whatever you want since this field is less important.<\/p>\n<div id=\"ez-toc-container\" class=\"ez-toc-v2_0_81 counter-hierarchy ez-toc-counter ez-toc-grey ez-toc-container-direction\">\n<div class=\"ez-toc-title-container\">\n<p class=\"ez-toc-title\" style=\"cursor:inherit\">Table of Contents<\/p>\n<span class=\"ez-toc-title-toggle\"><a href=\"#\" class=\"ez-toc-pull-right ez-toc-btn ez-toc-btn-xs ez-toc-btn-default ez-toc-toggle\" aria-label=\"Toggle Table of Content\"><span class=\"ez-toc-js-icon-con\"><span class=\"\"><span class=\"eztoc-hide\" style=\"display:none;\">Toggle<\/span><span class=\"ez-toc-icon-toggle-span\"><svg style=\"fill: #999;color:#999\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\" class=\"list-377408\" width=\"20px\" height=\"20px\" viewBox=\"0 0 24 24\" fill=\"none\"><path d=\"M6 6H4v2h2V6zm14 0H8v2h12V6zM4 11h2v2H4v-2zm16 0H8v2h12v-2zM4 16h2v2H4v-2zm16 0H8v2h12v-2z\" fill=\"currentColor\"><\/path><\/svg><svg style=\"fill: #999;color:#999\" class=\"arrow-unsorted-368013\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"10px\" height=\"10px\" viewBox=\"0 0 24 24\" version=\"1.2\" baseProfile=\"tiny\"><path d=\"M18.2 9.3l-6.2-6.3-6.2 6.3c-.2.2-.3.4-.3.7s.1.5.3.7c.2.2.4.3.7.3h11c.3 0 .5-.1.7-.3.2-.2.3-.5.3-.7s-.1-.5-.3-.7zM5.8 14.7l6.2 6.3 6.2-6.3c.2-.2.3-.5.3-.7s-.1-.5-.3-.7c-.2-.2-.4-.3-.7-.3h-11c-.3 0-.5.1-.7.3-.2.2-.3.5-.3.7s.1.5.3.7z\"\/><\/svg><\/span><\/span><\/span><\/a><\/span><\/div>\n<nav><ul class='ez-toc-list ez-toc-list-level-1 ' ><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-1\" href=\"https:\/\/zalvis.com\/docs\/using-nodejs-apps.html\/#ExpressJS\" >ExpressJS<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-2\" href=\"https:\/\/zalvis.com\/docs\/using-nodejs-apps.html\/#React_AngularJS_VueJS_NuxtJS_NextJS\" >React \/ AngularJS \/ VueJS\/ NuxtJS\/ NextJS<\/a><\/li><\/ul><\/nav><\/div>\n<h2 class=\"heading-text\"><span class=\"ez-toc-section\" id=\"ExpressJS\"><\/span>ExpressJS<span class=\"ez-toc-section-end\"><\/span><\/h2>\n<p>ExpressJS is a widely used web API framework for RESTful services. You need to install the ExpressJS package through NPM in order to get a working ExpressJS application. The command below can do this:<\/p>\n<blockquote><p>npm install expressjs<\/p><\/blockquote>\n<p>You can navigate your application URL, and it will send the \u2018Hello World!\u2019 response if you\u2019ve set up everything correctly.<\/p>\n<h2 class=\"heading-text\"><span class=\"ez-toc-section\" id=\"React_AngularJS_VueJS_NuxtJS_NextJS\"><\/span>React \/ AngularJS \/ VueJS\/ NuxtJS\/ NextJS<span class=\"ez-toc-section-end\"><\/span><\/h2>\n<p>The front-end frameworks we mentioned above are extensively used. The application should be developed in a local environment and then built through npm scripts provided by each framework in order to use hosting services for the frameworks we mentioned above. The build script of a framework is typically ran through the next command:<\/p>\n<blockquote><p>npm run build<\/p><\/blockquote>\n<p>The running scripts are different, even though the command does the same for all applications. For instance:<\/p>\n<p>vue-cli-service build &#8211;no-clean (VueJS) react-scripts build (ReactJS)<\/p>\n<p>The files of the application will be HTML files that are static with the pre-completed JS to the Common JS format. Once they\u2019ve been built accordingly, they will run without any problems. Since AngularJS, ReactJS, and VueJS are only static websites and don\u2019t have a server that is back-end running, you can transfer the files over to the document root of the website. Our recommendation is to transfer the files through SSH, FTP, or a CI setup that automatically transfers the code on git pushes.<\/p>\n<p>When it comes to NuxtJS and NextJS, these two SSR (Server Side Rendered) servers have both a reactive web application and a listening server running. Even though running them is a possibility, they are very complicated to set up and our support does not provide support for them.<\/p>\n<div class=\"blbss69e1065495e2b\" >If you enjoyed this article, then you\u2019ll love Zalvis's Cloud Hosting platform. Turbocharge your website and get 24\/7 support from our veteran team. Our world-class hosting infrastructure focuses on auto-scaling, performance, and security. Let us show you the Zalvis difference! <a href=\"https:\/\/zalvis.com\/\">Check out our services.<\/a><\/div><style type=\"text\/css\">\r\n@media screen and (min-width: 1201px) {\r\n.blbss69e1065495e2b {\r\ndisplay: block;\r\n}\r\n}\r\n@media screen and (min-width: 993px) and (max-width: 1200px) {\r\n.blbss69e1065495e2b {\r\ndisplay: block;\r\n}\r\n}\r\n@media screen and (min-width: 769px) and (max-width: 992px) {\r\n.blbss69e1065495e2b {\r\ndisplay: block;\r\n}\r\n}\r\n@media screen and (min-width: 768px) and (max-width: 768px) {\r\n.blbss69e1065495e2b {\r\ndisplay: block;\r\n}\r\n}\r\n@media screen and (max-width: 767px) {\r\n.blbss69e1065495e2b {\r\ndisplay: block;\r\n}\r\n}\r\n<\/style>\r\n","protected":false},"excerpt":{"rendered":"<p>cPanel can run NodeJs applications. NodeJs was created with the aim to create real-time sites with push capability, and the creators got their inspiration from applications like Gmail. We finally have web applications with two-way connections, where both the server and the client can initiate communication, allowing them to freely exchange data. To load your [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[9],"tags":[],"class_list":["post-592","post","type-post","status-publish","format-standard","hentry","category-cpanel-hosting"],"_links":{"self":[{"href":"https:\/\/zalvis.com\/docs\/wp-json\/wp\/v2\/posts\/592","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/zalvis.com\/docs\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/zalvis.com\/docs\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/zalvis.com\/docs\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/zalvis.com\/docs\/wp-json\/wp\/v2\/comments?post=592"}],"version-history":[{"count":2,"href":"https:\/\/zalvis.com\/docs\/wp-json\/wp\/v2\/posts\/592\/revisions"}],"predecessor-version":[{"id":595,"href":"https:\/\/zalvis.com\/docs\/wp-json\/wp\/v2\/posts\/592\/revisions\/595"}],"wp:attachment":[{"href":"https:\/\/zalvis.com\/docs\/wp-json\/wp\/v2\/media?parent=592"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/zalvis.com\/docs\/wp-json\/wp\/v2\/categories?post=592"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/zalvis.com\/docs\/wp-json\/wp\/v2\/tags?post=592"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}