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 09:46] jasservices:nodeserve [2024/08/13 11:48] (current) – [Nodeserve] jas
Line 1: Line 1:
-====== Nodeserve User Documentation ======+====== Nodeserve ======
  
 The Nodeserve system is designed to streamline the deployment and management of Node.js applications for EECS users. This platform allows users to easily host their Node.js apps on the web, providing a seamless interface for starting, and stopping their applications. By automating much of the setup and configuration, Nodeserve enables users to focus on development and learning without worrying about the complexities of server management. This guide will walk you through everything you need to get started with Nodeserve. The Nodeserve system is designed to streamline the deployment and management of Node.js applications for EECS users. This platform allows users to easily host their Node.js apps on the web, providing a seamless interface for starting, and stopping their applications. By automating much of the setup and configuration, Nodeserve enables users to focus on development and learning without worrying about the complexities of server management. This guide will walk you through everything you need to get started with Nodeserve.
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 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 52: Line 57:
 </code> </code>
  
-You can also delete a port allocation for a web:+You can also delete a port allocation for an app:
  
 <code> <code>
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:
Line 87: Line 92:
 4. Sometimes, you may need to terminate your application before the period of inactivity expires.  For example, if your app is already running, and you make changes to the code, the changes won't be in effect until your app is restarted.    To terminate your app, visit the [[https://nodeserve.eecs.yorku.ca/admin|Nodeserv Admin Page]].  After logging in with your EECS username and password, you'll see a list of your running Node.js apps with a "Terminate" button beside each.  Click the "Terminate" button beside the app that you wish to terminate, and your app will be immediately terminated.  4. Sometimes, you may need to terminate your application before the period of inactivity expires.  For example, if your app is already running, and you make changes to the code, the changes won't be in effect until your app is restarted.    To terminate your app, visit the [[https://nodeserve.eecs.yorku.ca/admin|Nodeserv Admin Page]].  After logging in with your EECS username and password, you'll see a list of your running Node.js apps with a "Terminate" button beside each.  Click the "Terminate" button beside the app that you wish to terminate, and your app will be immediately terminated. 
  
-5. Since your application is running on the server, you don't have direct access to view the console, but that doesn't mean that you can't view the console To modify your code to ensure that console messages are written to a file called "app.log" in your app directory, add the following to your Node.js app:+5. Since your application is running on server that you cannot login to, you don't have direct access to view the console.  Howeverthis doesn't mean that you can't view the console of your app.  To modify your code to ensure that console messages are written to a file called "app.log" in your app directory, add the following to your Node.js app:
  
 <code> <code>
services/nodeserve.1723556761.txt.gz · Last modified: 2024/08/13 09:46 by jas

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki