User Tools

Site Tools


services:nodeserve

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
services:nodeserve [2024/08/13 10:56] jasservices:nodeserve [2024/08/13 11:48] (current) – [Nodeserve] jas
Line 13: Line 13:
   % mkdir ~/nodejs/app1   % mkdir ~/nodejs/app1
  
-3.  Develop your Node.js app in its respective app directory.+3.  Change into your app directory, and create a //package.json// file using the **npm init -y** command.  Using the "-y" option stops npm from asking you questions such as version, description, author, etc. and uses the defaults.
  
-4.  For each app, create a package.json file using the **npm init -y** command.  Using the "-y" option stops npm from asking you questions and uses defaults.+  % cd ~/nodejs/app1 
 +  % npm init -y 
 +   
 +4.  Develop your app.  You can use **npm install** to install whatever packages you need.
  
-5.  Allocate a port number for your app using the **nodeserve** command.+5.  Test your app on any EECS machine.  It's harder to debug your app when it's running on the server, so it makes sense to do most of your debugging locally. 
 + 
 +6.  Allocate a port number for your app using the **nodeserve** command.
  
 Each Node.js application must be allocated a unique port number to communicate with the web server. Ports act as channels for data to flow in and out of your app. We allocate a specific port for your app to ensure it runs smoothly without conflicts with other apps. This avoids issues that can arise from choosing an arbitrary port, which might already be in use by another service or application. Each Node.js application must be allocated a unique port number to communicate with the web server. Ports act as channels for data to flow in and out of your app. We allocate a specific port for your app to ensure it runs smoothly without conflicts with other apps. This avoids issues that can arise from choosing an arbitrary port, which might already be in use by another service or application.
Line 59: Line 64:
 </code> </code>
  
-6.  Visit your app on the web by visiting:  https://nodeserve.eecs.yorku.ca/<user>/<app> where <user> is your EECS username, and <app> is your application name.  +7.  Visit your app on the web by visiting:  https://nodeserve.eecs.yorku.ca/<user>/<app> where <user> is your EECS username, and <app> is your application name.  
  
-The web server will look up the port number allocated to your app, and set the port number in the PORT environment variable.  It will start running your app.  It will forward client requests from https://nodeserve.eecs.yorku.ca/<user>/<app> to your application running on http://localhost:port.+The web server will look up the port number allocated to your app, and set the port number in the PORT environment variable.  It will start running your app.  It will forward client requests from https://nodeserve.eecs.yorku.ca/<user>/<app> to your application running on http://localhost:<port>.
  
 A few additional notes: A few additional notes:
services/nodeserve.1723561007.txt.gz · Last modified: 2024/08/13 10:56 by jas

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki