nick kaufmann
nick kaufmann

Reputation: 21

node app.js localhost not working

on WINDOWS ...after install express-seed and node.js for the "blog" tutorial, i get the same cmd prompt after typing node app.js. another time i got body parser and error handling errors i tried alot of solutions, even had a local host run with another tutorial, but i would like to run from the blog tutorial due to some slight differences of the set-up. Of course im a newb, and i know theres tons of answers on the forum, but none are correcting my issue...please help. and everytime i try to post my report on here it errors me saying i have to indent each line 4 spaces. im just losing in general. Is there a step im missing? all the tut's say just do 'this' and 'this' and i have a local host running so i can make changes to views. any help?

// Module dependencies.

var express = require('express');

var app = express.createServer();

// Configuration

app.configure( function() {

});

// Routes

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

app.listen(3000);

Upvotes: 2

Views: 3725

Answers (1)

Paul
Paul

Reputation: 36319

what version of node & express are you running?

From the command line you can check with:

node --version

and

express --version

From your code, it looks like an older version of express (version 3 or less), but I'm betting you didn't specify the version on the npm install, which will give you the latest version (4+). There's a lot of breaking changes between those versions, so you can't run old code with the new framework successfully. My bet is that your blog tutorial hasn't been updated to express 4.x yet.

Upvotes: 2

Related Questions