In the last section, we created our user interface in index.html
; that's the only file we created. Now, we want to start to create our server, the Node.js server.
The first thing I will do is create a package.json
file. We could manually create it, but I'll to open a command line into our projects
folder and run npm init
, and of course you have to have Node.js installed.
So, the name will be chatio
, version
will be 1.0.0
, and description
will be simple chat app
. We'll change entry point
to server.js
. That's good and then put your own name so that should go ahead and create it:
I will add it to Sublime Text. Let's go to the C:\Projects\chatio
. There's our package.json
file. Now, we want to go in the code and add a couple dependencies. So, we'll say dependencies
and add socket.io
and express
(latest versions) as shown in the following code snippet:
"dependencies": { "socket.io": "*", "express": "*" }
Let's save that and we'll go back to our command...