Http.listen(port, () => console.log('listening on port ' + port)) const express = require('express') Ĭonst http = require('http').Server(app) Īpp.use(express.static(_dirname + '/public')) Hello worldĪnd outside them, in the main directory, we define our server.js file that will set up our application. Within it, we are going to place a simple index.html with just a line of Hello World to test it out. Once installed, we create a new directory called public that is going to be the root directory served. Now, to easily populate the dependencies property with the things we need, we will use npm: $ npm install express -save On my case, I filled up more than the necessary fields like my GitHub Repo and others, but it is fine with only a minified version (name, version, description and dependencies). It is recommended to place it in a new empty directory, I will call mine socket-uno. We create a package.json manifest file that describes our project. We are just only going to use two dependencies, Express as the web framework and Socket.IO as the real-time engine. The first goal is to set up a simple HTML webpage that serves out an empty canvas. On the server-side, we manage a Node.JS server to attend all requests performed by users connected through SocketIO. In this article, I am going to explain step by step everything I came up to create the popular UNO game from scratch just in a simple canvas for the end-user that is going to play giving them a lightest client, just the browser.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |