Category Archives: node.js

node.js – port test

require(’portscanner’).checkPortStatus( 80, ’192.168.1.234′ , function(error, status) { console.log(status) })

Posted in node.js | Leave a comment

git (github) repository as npm dependency

{ "name": "node-sample-app", "version": "0.0.1", "private": true, "scripts": { "start": "node app.js" }, "dependencies": { "private-module1": "git+https://github.com/marioosh-net/private-module1", "private-module2": "git+ssh://github.com/marioosh-net/private-module2#master" } } more info here

Also posted in git, github, npm | Leave a comment

node.js – Socket.IO

Dependencies npm install socket.io Server var fs = require(’fs’); var app = require(’http’).createServer( function(req, res) { // serwuj client.html fs.readFile(’client.html’, function(err, data) { res.writeHead(200); res.end(data); }); } ); app.listen(8081); var io = require(’socket.io’).listen(app);   io.sockets.on(’connection’, function (socket) { // send welcome message socket.emit(’from-server’, { date: ‘welcome to time service’ });   // send time on [...]

Also posted in Uncategorized | Leave a comment