addyosmani / backbone-fundamentals

:book: A creative-commons book on Backbone.js for beginners and advanced users alike

Home Page:http://addyosmani.github.io/backbone-fundamentals/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Bug with directory location in the server.js file in the Book Library app

n8finch opened this issue · comments

Hello Addy.

This is my first issue on GitHub, I hope I'm doing this right, but let me know if I need to make a pull request for this. I would be happy to. Thank you for the Backbone Application book. It's been great to work through so far, and I appreciate your thorough explanations.

Ok, when I typed out your code for the server.js file in my application, I got an error in the window: Cannot GET / . Also in the dev tools, http://localhost:4711/ returns a 404 Not Found.

I think the issue is with the line of code in server.js:
app.use( express.static( path.join( application_root,'../', 'site') ) );

This moves the reference out of the root folder, as I understand it. When I took out the two .., the app displays fine, so now, my line of code looks like:
app.use( express.static( path.join( application_root,'/', 'site') ) );

This is assuming that the server.js file is running in the root at the same level as the node_modules and site directories, which is what I understood from your directions.

I think I'm supposed to submit a PR for this, which will also be my first. Please let me know if I'm getting this right, or what you would like me to do from here.

Again, thanks!
Nate

I was running into this same issue too and your fix worked for me. I'd recommend submitting a PR since it is such a simple fix, it shouldn't be an issue merging it. Then again I'm not the repo owner so maybe Addy would prefer just making the change himself.

Thanks for the fix though.

Hey Kyle, thanks for the message. I'll probably go ahead and submit the PR. Cheers!