WebFaction
Community site: login faq

I put app.js in my apps root directory and basic code like below:

var express = require('express'); var app = express();

app.get('/', function (req, res) { res.send('Hello World!'); });

var server = app.listen(**,'...***', function () { var host = server.address().address; var port = server.address().port;

console.log('Example app listening at http://%s:%s', host, port); });

But is showing 502 error. what I'm doing wrong? I edited bin/start file and pointed app.js file. I stop server and and start again. also i installed npm install -g express but not working. if I point default hello-world.js it works fine. What to do now with express please help.

asked 31 Jul '15, 09:29

maktabun
1313
accept rate: 0%


A 502 error indicates that your application is not listening on that port. You need to log why the server is either not starting or catch why it is terminating.

permanent link

answered 31 Jul '15, 12:16

aaront ♦♦
7664
accept rate: 27%

another forever isue!!! I installed node.js manually. create custom app listening on port. its working fine. but its exiting when i close terminal. find some docs forever is solution for it. I installed but when I type forever start app.js ists shows forever:command not found. What to do now?

(31 Jul '15, 17:00) maktabun

Have you installed npm and subsequently the forever package? https://github.com/foreverjs/forever

(31 Jul '15, 17:25) bmeyer71 ♦♦

yes but forever command not found. even forever --help not working. I followed this... http://stackoverflow.com/questions/18687850/setting-up-node-js-on-webfaction But still in problem.

(31 Jul '15, 17:57) maktabun

Try specifying the full path to the forever binary to see if that works.

(31 Jul '15, 18:04) bmeyer71 ♦♦

also tried that... but didn't worked

(31 Jul '15, 19:03) maktabun

Your app wasn't running, so I started it for you with the following command (I've changed the app name since this is a public forum):

~/webapps/app_name/node_modules/.bin/forever start ~/webapps/app_name/app.js

Your site is now working.

(31 Jul '15, 19:34) seanf

Thanks a lot.

(31 Jul '15, 20:28) maktabun
showing 5 of 7 show 2 more comments
Your answer
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Question tags:

×67
×3

question asked: 31 Jul '15, 09:29

question was seen: 3,665 times

last updated: 31 Jul '15, 20:28

WEBFACTION
REACH US
SUPPORT
AFFILIATE PROGRAM
LEGAL
© COPYRIGHT 2003-2019 SWARMA LIMITED - WEBFACTION IS A SERVICE OF SWARMA LIMITED
REGISTERED IN ENGLAND AND WALES 5729350 - VAT REGISTRATION NUMBER 877397162
5TH FLOOR, THE OLD VINYL FACTORY, HAYES, UB3 1HA, UNITED KINGDOM