Book Image

Node.js Blueprints

By : Krasimir Stefanov Tsonev
Book Image

Node.js Blueprints

By: Krasimir Stefanov Tsonev

Overview of this book

Table of Contents (19 chapters)
Node.js Blueprints
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Index

Using node-webkit


There are several tools available to write desktop apps. We will use node-webkit (https://github.com/rogerwang/node-webkit). It's an app runtime based on Chromium and Node.js. It's distributed as a binary program we run to see the result of our code. It is available for all the major operating systems—Linux, Windows, and Mac. So during the development, we will use the nw executable file, which is the same as using the node executable to run Node.js scripts. The nw file can be downloaded from the official repository of the tool in GitHub.

Every desktop application written with node-webkit must contain at least two files: package.json and the main HTML file. Similar to the modules we wrote so far, the package.json file holds the configuration of our application. The following is a simple example:

{
  "name": "nw-demo",
  "main": "index.html"
}

It's important that we set a value for the main property. It should point to the main HTML file of our file browser. The path is relative...