Newbie example for node.js + express please



I am new to node.js & c9.

I’d like to start by writing some simple web services which do simple calculations based on query parameters, eventually doing more complex calculations on JSON POST data.

Is “express” the best package to use to access this sort of information?

I tried writing a simple app that had require(‘express’) at the top, but that would only work if I first started a Run Configuration specifically set up to use express - even though I had clicked on the “set as default” option.

I tried a simple “hello world” app like this:

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

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

    app.listen(process.env.PORT, function () {
      console.log('Example app listening!');

That gave me an error as follows:
Debugger listening on port 15454
throw er; // Unhandled ‘error’ event

Error: read ECONNRESET
    at exports._errnoException (util.js:870:11) 
    at TCP.onread (net.js:544:26)    

Would someone point me in the right direction please?

If I can get a simple “hello world” application working, then I might be able to start doing something a little more adventurous.


I’d be glad to help. If you could share your workspace with me, I can help you setup a working example!

Share with “shadowcodex1”


Thanks for the kind offer.


Please have a look at Server3.js in the node.js folder.


Alright I’ll be on tomorrow as I am off for today.


I have same problem. Can U tell me how to fix this?
My app is geting this error randomly with no user or code actions.


Go to a terminal, and write “npm install -g express-generator”,
and then write “express project_name”

Note: the express-generator module is made by the Express guys, and its an awesome way to start with Express! It handles ECONNRESET errors and does not crash and continues the server up running! Plus its an awesome backbone skeleton :slight_smile:

Go to the directory in the terminal (“cd project_name”)
then write “npm install”, this will install the extra modules required provided in the .conf file

and to run the app, all you need to write is “npm start”! classy

Hope this helps :slight_smile: