Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

JavaScript Build a Simple Dynamic Site with Node.js Handling Routes in Node.js User Route

Workspace unavailable when I access port 3000

Workspace Unavailable This is a preview link for a Treehouse Workspace that is not currently active.

If you are the workspace owner, you can launch it again via the Treehouse site.

2 Answers

Did you enter node app.js in the console prior to the preview?

treehouse:~/workspace$ node app.js                                                       
Server running at http://<workspace-url>/      

Yes typed in the command to execute the server in Node.js.

Server running at http://<workspace-url>/
const username = request.url.replace("/", "");

ReferenceError: request is not defined
at Object.user (/home/treehouse/workspace/router.js:18:20)
at Server.<anonymous> (/home/treehouse/workspace/app.js:11:12)
at emitTwo (events.js:126:13)
at Server.emit (events.js:214:7)
at parserOnIncoming (_http_server.js:660:12)

This is what happens to me, even though using Treehouse own workspace.

Is request a parameter of the function, or did you use req?