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

Ryan Behrens
Ryan Behrens
1,949 Points

what if we don't create an app variable and just name it something else? will there sill be methods ?

so we require express, then access the module by assigning it to a variable that we call 'express'. --can we call it anything we want, instead of express?

so we assign the newly created variable 'express' to another new variable that we call 'app'. -- can we call this anything we want as well, say for example orange? and if so, will it have the same methods so we can use things like ' app.get' only it would be 'orange.get'???

1 Answer

Hi Ryan,

Yes, your variables can be named whatever your like. However, using other names will certainly make your code harder to read/follow, since the App and var nameofpkg = require('nameofpkg') conventions are pretty well ingrained in the node/express community. They communicate their purpose clearly and simply, which is just good coding practice in general.

Best, Cena