Quickly serve a directory using (nodejs) http-server in intellij


As it seems there is a internal web server feature in WebStorm, but it is not yet(?) available in IntelliJ. We have been busy providing a proof of concept using AngularJS and BlueEyes and this is helping out with quickly running a web server and serving files using 'http://'

It is easy to run a web server using the "external tool" option from the settings (however it does not integrate with the rest of IntelliJ. For example when you choose "Open in Browser", it will open the 'file://' URL for the resource.

However debugging does work (just make sure you have setup remote JavaScript debugging in your run configuration

Anyway perhaps you didn't think of it (as it is not rocket science :)

The settings below assume Node.js http-server is installed. First install Node.js and then install http-server using npm:

$ sudo npm install http-server -g

Here is a screenshot which illustrates configuring IntelliJ:

Note, if you don't want to install Node.js, you could also use "python -m SimpleHTTPServer" as the command (make sure you set the working directory). However Node.js' http-server is much faster.

This article does not necessarily reflect the technical opinion of EDC4IT, but purely of the writer. If you want to discuss about this content, please send us an email at support@edc4it.com.