Create the Socket.IO Server
Video Lecture
Description
We are going to create, compile and start a simple Socket.IO server.
First, create the server script.
./src/server/server.ts
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 |
|
Next, we need to install the socket.io
package.
npm install socket.io
Now we can transpile this TypeScript code into JavaScript code that Node.js can run.
tsc.cmd ./src/server/server.ts --outDir ./dist/server/
This should have created a new JavaScript file named server.js
in the ./dist/server/
folder.
Now we can execute the server.js
file.
node ./dist/server/server.js