Instructions, code snippets, demos and labs for the Node.js RD held at the Crisp office in Stockholm on March 22nd 2012.
Really Old JavaScript RD might be helpful as a refresher, and this one.
Create a Web Server that responds with the query parameters passed as JSON strings. Example response:
$ curl -i "http://localhost:3000/?p=xxx&xxx=p"
HTTP/1.1 200 OK
Content-Type: text/plain
Connection: keep-alive
Transfer-Encoding: chunked
{ p: 'xxx', xxx: 'p' }
Some hints can be found in labs/lab1-web-server/server.js
.
npm install -g nodeunit
cd labs/lab2-nodeunit
nodeunit test
Depending on your OS you may need to sudo
(or equivalent) the npm install
command.
Create a Chat Server where each socket is identified by an id of the form id-[count]
.
- net api
- JavaScript is a dynamic language.
npm install -g express
mkdir labs/lab4-express
cd labs/lab4-express
express --help
Depending on your OS you may need to sudo
(or equivalent) the npm install
command.
Create a web application using the express
executable, template engine ejs, no session support and plain css.
npm install -g socket.io
mkdir labs/lab5-socket.io
cd labs/lab5-socket.io
Create a browser based chat application using socket.io. A starting point can be found in labsolutions/lab5-socket.io