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) Getting Started with Express Your First Express App

Confused about the directory structure - where is this taking place?

It's not clear where in the directory structure this is meant to take place. I ran the "git clone" command, but that created another express-basics folder inside my express basics folder. It looks like this: Sites > express > express-basics > express-basics

  • The outer express-basics directory has: app.js, express-basics, node_modules, package.json, README.md, src
  • The inner express basics has: package.json, README.md, src

The inner express-basics is where I'm working, because that's what I got when I used the 'git clone' command but it doesn't have .gitignore or app.js. So going to localhost:3000 shows "This webpage is not available: ERR_CONNECTION_REFUSED".

2 Answers

I figured out that the problem was that in the previous video, I missed that he had moved into the src directory before creating his app.js file. The git clone command is for people who are starting from this video forward.

Rich Donnellan
MOD
Rich Donnellan
Treehouse Moderator 27,671 Points

Allison,

Running git clone repo-path automatically creates a folder with the name of the repo wherever you set your path to in your shell. If you have an existing folder, you can run git clone with another argument to clone into the current working directory without the subfolder. Simply add a space + period after the git path.

git clone repo-path .

You could move the inner folder content to the root folder, but it's probably best to remove what you have and start over.

When you say, "remove what you have", do you mean remove the inner folder? I just want to be clear.

And, to follow along with this lesson, is it necessary to run everything as shown in the teacher's notes, as shown below?

git clone https://github.com/hdngr/treehouse-express-basics.git express-basics
cd express-basics
git checkout yourFirstExpressApp
Rich Donnellan
Rich Donnellan
Treehouse Moderator 27,671 Points

Delete all folders/files in the main express-basics folder, then rerun the git clone using the method I provided.

Or, delete everything, do not create your own express-basics folder, and follow the teacher's notes to a T.

Let me know if you have any other questions/issues! Good luck!