Book Image

Node.js Blueprints

By : Krasimir Stefanov Tsonev
Book Image

Node.js Blueprints

By: Krasimir Stefanov Tsonev

Overview of this book

A straightforward, practical guide containing step-by-step tutorials that will push your Node.js programming skills to the next level. If you are a web developer with experience in writing client-side JavaScript and want to discover the fascinating world of Node.js to develop fast and efficient web and desktop applications, then this book is for you.
Table of Contents (14 chapters)
13
Index

Understanding the basic application structure


In the previous chapter, we used Express and Jade to write the delivery of the assets (HTML, CSS, and JavaScript) of the application. Here, we will stick to pure JavaScript code and will avoid the usage of additional dependencies. The only thing that we need to add to our package.json file is Socket.IO:

{
  "name": "projectname",
  "description": "description",
  "version": "0.0.1",
  "dependencies": {
    "socket.io": "latest"
  }
}

After we call npm install in our project's folder, Socket.IO is placed in a newly created node_modules directory. Let's create two new directories. The following screenshot shows what the application file structure should look like:

The file structure

The application will read the styles.css file and deliver its content to the browser. The same thing will happen with /html/page.html, which is the file that contains the HTML markup of the project. The Node.js code goes to /index.js.