User Tools

Site Tools


nodejs:development-mode

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
nodejs:development-mode [2024/04/04 03:53] kirtisinghnodejs:development-mode [2026/04/15 09:44] (current) kirtisingh
Line 1: Line 1:
 ===How to run/work with development mode for NodeJS Apps=== ===How to run/work with development mode for NodeJS Apps===
  
-**Step 1 :** Log into N99panel. From under N99panel dashboard, click 'Node Apps'+**Step 1 :** Log into N99panel. From under N99panel dashboard, click 'Dev Mode Apps (via SSH)' 
 + 
 +{{:nodejs:nj2-dev-mode.png?direct&400|}}
  
-{{:nodejs:click-node-apps.png?direct&400|}} 
 \\ \\
  
-**Step 2 :** Now click 'Link a Node App+**Step 2 :** Now click 'Link a App (Dev Mode)'
  
-{{:nodejs:link-node-app.png?direct&400|}}+{{:nodejs:click-nj2-dev-mode-add.png?direct&400|}}
 \\ \\
  
 **Step 3 :** Fill in the form as under **Step 3 :** Fill in the form as under
  
-{{:nodejs:dev-form-2.png?direct&400|}} +{{:nodejs:nj2n-link-a-node-app.png?direct&400|}} 
- +\\
-**Important point :**\\ +
-  - Select the VHost (website) mentioned along with the user and the port range.\\  +
-  - Enter the ‘App Web path’ . This would be like /app1 or /app2 or it can even be the website root i.e. /\\ +
-  - Enter the ‘App Port’ . The port entered under should be within the range of the port numbers mentioned in point 1.\\ +
-  - Select the ‘App Mode’. This should be ‘Development’\\+
  
-With the above steps, you have mapped the web-server to the VHost/Websites URL part and the port number where we can expect the NodeJS App to be running.+**Important points :**\\ 
 +  - Select the VHost (website) mentioned along with the user.\\  
 +  Enter the ‘Local URL’ . This would be like /app1 or /app2 or it can even be the website root i.e. /\\ 
 +  - Enter the ‘App Port’ . The port on which your App runs . You need to ensure that your App listens on interface 0.0.0.0 instead of 127.0.0.1 or localhost which typically are used\\ 
 +  - The SSH daemon w.r.t. the concerned user will be restarted to enable backend port mappings. Therefore your dev mode app and any existing dev mode apps would need to be manually started. This applies whenever the SSH daemon is restarted. But when NodeJS Apps run in app/production mode, this does not apply. App/production mode is recommended when you have completed development or testing of the App, as each App in that mode has its own lifecycle
  
 Read further on how to start the App when logged into SSH Read further on how to start the App when logged into SSH
Line 27: Line 27:
 -------------------------------------------------------------- --------------------------------------------------------------
  
-N99panel comes with multiple NodeJS versions i.e. 10, 12, 14, 16, 18, 20. These versions can be referenced from within SSH using the commands +N99panel comes with multiple NodeJS versions i.e. 10, 12, 14, 16, 18, 20, 22, 24. These versions can be referenced from within SSH using the commands 
 <code> <code>
 node10 node10
Line 35: Line 35:
 node18 node18
 node20 node20
 +node22
 +node24
 </code>  </code> 
 respectively. The npm’s accompanying these versions can be referenced via  respectively. The npm’s accompanying these versions can be referenced via 
Line 44: Line 46:
 npm18 npm18
 npm20 npm20
 +npm22
 +nom24
 </code> </code>
 respectively. The default node command refers to node18. Please refer to this article to change the default version of node CLI - [[:nodejs:cli-version|How to change the default version of node or NodeJS CLI for a user]]\\ respectively. The default node command refers to node18. Please refer to this article to change the default version of node CLI - [[:nodejs:cli-version|How to change the default version of node or NodeJS CLI for a user]]\\
Line 55: Line 59:
 Now assuming that you created a app folder app1 , now under that folder upload all your source files including package.json . Lets’s say that we wish to user version 16 , to run NPM commands w.r.t. that ideally we will use npm16  . Now assuming that you created a app folder app1 , now under that folder upload all your source files including package.json . Lets’s say that we wish to user version 16 , to run NPM commands w.r.t. that ideally we will use npm16  .
  
-To run the app, we should first ensure that the NodeJS source file creates the Node server at the ‘App Port’ number as specified earlier. We’ll explain further via example +To run the app, we should first ensure that the NodeJS source file creates the Node server at the ‘App Port’ number as specified earlier and the interface/IP to which it binds is 0.0.0.
-Let’s say the user port range is 50051 to 50060 , and the port we entered under ‘App Port’ is 50051 +
-Now my app file is say app.js In my app.js I would need to create the server on port 50051 . +
-To now actually run the app, we just need to type+
  
 <code> <code>
nodejs/development-mode.1712202791.txt.gz · Last modified: 2024/04/04 03:53 by kirtisingh

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki