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


Patrik Horváth
Patrik Horváth
11,110 Points

Node.JS - IntelliJ, Where to put code?

hi today i started learn Node.JS and got bit confused where i should give my code in IDE like IntelliJ, because you get a lot of Filess in IDE also you have to Select With CSS you will USE or etc settings while creating Project :


alt text

its maybe some kind of MVC so my code should go to View ? or Public ? because Andrew Chalkley never told this in basics and he was using workspace

i have done all Installation like in TeamTreeHouse Guide


1 Answer

It depends what you are working on with node.js. From this image you posted it looks like it is an express application scaffold. The www file is the file that is executed which then ends up starting the node.js server. The routes folder contains all your routes and their handlers. Your views folder contains your templates.

All this will make a lot more sense once you actually dive into Express.js.

If you just want to mess around with Node.js to learn basics you can just create a blank new project in your IDE (empty folder) and place a file called app.js in it.

To execute the code in your app.js file -- in your command line navigate into your project and then run node app.s

sorry * node app.js

Patrik Horváth
Patrik Horváth
11,110 Points

yea i saw only Express.JS option when i making new Node.JS project there is no other option =\ and is there way to do it normal way ? withou using console "node app.js" cause this is not so handy and IDE should run it automaticaly or not ?

I am not familiar with IntelliJ. But most IDE's have built in command lines. You always start a node app with your command line by typing node and then stating the file you want to run. If you just want to start with some basics I would just create a blank project (I am sure that is an option with IntelliJ?). Express.js is a framework to specifically create a web application.