intellij idea setting up blank node.js project -


i'm kinda new intellij idea.

the node.js project template intellij idea node.js express project — nice (you web server hooked run project with, etc), sorts of ugly stuff in jade. want no-frills, no nonsense node.js project... http optional.

i see wanting node.js project basic web handling stuff like: body-parser, cookie-parser, serve-favicon, method-override, , morgan (which http logging) — bonus question/question day. right want project template can press run afterwards , see output on console or something.

from reckoning have 2 choices:

1: create empty project , run app using node.js interpreter.
mean going through new project wizard , selecting empty project option. start developing node.js application.

when comes running application, you'll need define new run/debug configuration or edit 1 might have.
when doing this, click green + button, select node.js.
there can name configuration, ensure "activate tool window" checked , configure javascript file main file (e.g. app.js).

this method can bit fiddly (especially @ beginning folder/package creation) you're not using node.js module intellij doesn't know you're trying create node.js application.


2: create node.js express app, clear out , save project templat
first of all, go through new project wizard , create node.js express app. once ide has finished indexing , installing node.js packages needs: start deleting folders!
node.js designed used in modular way can pretty remove everything. recommend deleting except for:

.idea/ because intellij thing , needed.
node_modules/ because intellij configures library root future modules use imported automatically. can delete inside node_modules/ directory though.
app.js because node.js application have main js file called app.js might keep one. still delete inside keep file.
<projectname>.iml because intellij thing , needed.
package.json because dependency management file. can delete inside of scripts , dependencies json objects.

now if you're doing in intellij (i.e. not webstorm) have option save project template.
means when come developing next node.js application, instead of doing above on again, can select custom template , developing!.
save project project template, go to:

tools > save project template... 

then fill in boxes whatever want need/want , click ok.

if you're running webstorm, you'll have save project somewhere (easily accessible folder, github, etc.) , make clone/fork when want develop new application.


one of important things remember node.js still pretty new language.

express apps common in node.js development world , creating template/framework them simple, business move jetbrains.

i'm sure (and on forums jetbrains has indicated) jetbrains continue make more node.js templates/frameworks supported on ide(s) suspect added webstorm main ide javascript development.


Comments