Failed to start Express app for Nodester

I'm having trouble deploying an express app to a node.

After successfully launching the default hello world app for nodeter, I ran the following commands in the nodeter CLI

nodeter npm install express

After that, I installed express on the local git of my application

npm install express  
express  
mv app.js server.js // Changed the port from 3000 to the port given to me
git add .
git commit -m 'message'
git push origin master

      

I seem to have followed all the instructions given by different blogs, but when I click on the url (http://dlq.nodester.com) the app shows offline.

Despite the fact that the work with the same application is done locally. those. node server.js

runs the application on my local machine (clicking on the url shows the Express page).
The same app doesn't work when clicking on a node.

Please help

+3


source to share


2 answers


Update:

Nodester Core Developer (alejandromg on IRC) looked at your issue. You are having a merge problem in your git repository. It seems like it was a merge conflict. You can find the crux of the git conflict conflict on GitHub . Alejandro was kind enough to resolve the conflict on the Nodester platform. Your application should now work flawlessly at http://dlq.nodester.com/ .

I'll leave the rest of the answer as a possible way to fix this.


Hi Nodester guy (er)!

Nodester, like PaaS, uses internal port forwarding so that every Nodester application runs on port 80 so that it can be easily accessed from the internet. Since Nodester runs on a single EC2 instance, we assign you a specific port. This port will be internally forwarded to yours dlq.nodester.com:80

, but your application will use the one released by Nodester.

I know you changed your port, but try using the alternative method below.

You can access the port you were assigned to by running nodester app info dlq

. It should show you that your application is running or stopping and the port.

To tell Express to use a port (as indicated in the help page (see the FAQ section) , you can use either the hardcode number and number, or accept an environment variable available for each Nodester application for itself.

This should work:



app.listen(process.env['app_port'] || 80)

      

or

app.listen(process.env.port)

      

The former allows you to develop locally on port 80 (or whichever you choose), for the latter you will need to set an environment variable containing the string or port number you have released.

Change this, push your code to Nodester (which seems to work, I'm glad!). After that, the app should launch automatically and (hopefully) work. If you still have problems, please let us know on the Nodester #nodester IRC channel at irc.freenode.org or use the web chat client .

Additional troubleshooting :

You seem to be using the nodepm npm command incorrectly (judging by your information there). It should be:

nodester npm install dlq express

      

(Thanks to Chris for this hint)

+2


source


For those who have problems with: nodester npm install express

How I got express start on node (from memory):

nodester app create myapp
cd myapp
npm install express -g      [if you don't have it yet]
express
mv app.js server.js

      

open server.js

and listenprocess.env['app_port'] || 80

git add .
git commit -m 'init express'
git push origin master

      



see nodestor logs and find app reloaded

NOW we can

nodester npm install express
nodester app restart

      

And everything should work at this point

0


source







All Articles