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 trial

JavaScript Express Basics (2015) The Request and Response Objects in Express Requests and the request object

Modou Sawo
Modou Sawo
13,141 Points

Non of my commands in the console work, i.e: req

Here my app.js code:

'use strict';

var express = require('express'),
      posts = require('./mock/posts.json');

var app = express();

app.get('/', function(req, res){
  res.send("<h1>I think I'm in love with her</h1>")

app.get('/blog:title', function(req, res){
  var title = req.params.title;
  var post = posts[title];
app.listen(3000, function(){
  console.log("The frontend server is running on port 3000!")

Running the following in the terminal; some of the stuff he did in the video are outdated...

Running two terminal tabs:

^CModous-Mac:personal-site msawo$ nodemon --debug src/app
[nodemon] 1.11.0
[nodemon] to restart at any time, enter `rs`
[nodemon] watching: *.*
[nodemon] starting `node --debug src/app index.js`
Debugger listening on [::]:5858
The frontend server is running on port 3000!
Modous-Mac:personal-site msawo$ node --inspect --debug-brk src/app.js
Debugger listening on port 9229.
Warning: This is an experimental feature and could change at any time.
To start debugging, open the following URL in Chrome:
Debugger attached.

I opened localhost:3000; however, the blog routes don't even work now -____- and opened the debugger in that devtools://devtools/remote/serve_file/@60cd6e859b9f557d2312f5bf532f6aec5f284980/inspector.html?experiments=true&v8only=true&ws= route

1 Answer

Seth Kroger
Seth Kroger
56,413 Points

Double-check the blog route, because in the video he has '/blog/:title' and you are missing one of the forward slashes.

Modou Sawo
Modou Sawo
13,141 Points

Ahah! Thanks Seth, that WAS the problem.