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 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...