Lecture 13.1 (Tuesday, May 18)
- 2 more weeks
- P4 due today, A3 in one week
- Quiz 5 end of next week
- Remember I drop one quiz
We talked about:
- SocketIO, allowing bidirectional communication between browser and server
- Uploading files
Remember, file uploads have two parts:
- They show up on the server in
request.files, as FileStorage objects
You grab the bytes, or you save the file somewhere.
I've made an example game that only supports two players on the same computer, Tic-Tac-Toe.
Let's walk through its code and how it works!
- Add an AI
- Support networked multiplayer support with SocketIO
It's useful in practice to use preprocessors. These can do a number of things:
- Check our code for common problems (linters, such as
csslintfor CSS, and HTML validators)
- Compress and obfuscate our code, to decrease the network traffic and make it (slightly) harder to reverse-engineer (minification).
I will demo some of these on the Tic-Tac-Toe example:
- minification with
- linting with
We can also do other useful things:
- concatenate all JS together into a single file (decrease network load)
- same for CSS
Formerly, there was a more diverse array of platforms: Ruby, Java, etc. But now Node is most of what you need.
They can be installed with Node's package manager
$ npm install -g uglify-js clean-css html-minifier jshint
This will install them all globally.