Setting Up a JavaScript Development Environment Using Node.js

There are so many methods for setting up a JavaScript development environment that it is difficult to focus on just one. Most good Integrated Development Environment (IDE) tools provide at least some sort of capability to easily set up a JavaScript development environment. So if you have a favorite IDE, you should check out what JavaScript capabilities it has.

To effectively work with JavaScript to build AngularJS applications, your development environment needs to have the following components:

Editor: The editor is simply there to enable you to create the necessary JavaScript, HTML, and CSS files to build your AngularJS application. There are many editors out there, so pick one you are familiar with. I typically use Eclipse because it tends to have all the functionality I need.

Web Server: The web server will need the capability to serve the static HTML, CSS, and JavaScript files as well as the capability to provide at least some server-side scripting to handle HTTP requests from the AngularJS applications. For most basic setups you can simply have the web server running on your development machine.

Browser: The final component you will need is a web browser to test and try your applications. For the most part JavaScript and AngularJS applications will run across the major browsers the same. However, there is also some functionality that will not work the same between browsers. It is always a good idea to test your applications in the major browsers that your customers will use to ensure that it works correctly in all of them.

To set up your development environment, first pick your favorite editor that supports JavaScript, HTML, and CSS. Then choose a good web browser. For this book, I’ve used Eclipse and Chrome as my editor and browser (however, the examples also work in Firefox and newer versions of Internet Explorer).

Finally, you need to set up a web server. I thought about using something like XAMPP that provides an Apache web server, or focusing on a specific IDE’s capabilities, but instead decided to go with Node.js using Express. I made that choice for several reasons. The first reason is that Node.js is just cool and I think everyone who does JavaScript development should at least look at it. The second reason is that Node.js is very easy to set up and get running, as you will see in a moment. The third reason is that for first learning JavaScript, Node.js is much simpler to use than having to deal with using a web server and browser.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset