Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trialBrian Oula
439 PointsCannot GET / error
Can't figure out what's wrong here
'use strict';
var express = require('express');
var app = express();
app.get('/', function(req, res){ res.send("<h1>I Love Treehouse!</h1>"); });
console.log("complete") app.listen(3000);
2 Answers
Brian Oula
439 PointsHi Matthew
I egt the following error in the console "Failed to load resource: the server responded with a status of 404 (Not Found)"
I'm trying to just load the page with the message 'I Love Treehouse!'
matthew jimenez
13,599 PointsAre you running the file with
node fileName.js
And then going to
localhost:3000
matthew jimenez
13,599 PointsThe only thing I see that is wrong is that you have a console.log statement right before your app.listen() on the same line. Which would be okay but you don't have a semicolon after it
Other than that, all I can think of is that you are going to the wrong port on your machine.
You should be visiting localhost:3000 in this case.
Also, some ide's can mess up the port number; you can try to run the app from your command/terminal by navigating to the file and running node FileName.js
Brian Oula
439 PointsI had the wrong file path! Thanks for responding.
matthew jimenez
13,599 Pointsmatthew jimenez
13,599 PointsDoesn't look like anything is wrong, what are you trying to accomplish?