Skip to content

Instantly share code, notes, and snippets.

@aaronbartell
Created January 3, 2015 17:16
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save aaronbartell/67c5fa28abe86a701ad0 to your computer and use it in GitHub Desktop.
Save aaronbartell/67c5fa28abe86a701ad0 to your computer and use it in GitHub Desktop.
Git server on IBM i using Node.js
var express = require('/QOpenSys/QIBM/ProdData/Node/bin/node_modules/express');
var app = express();
var server = require('http').createServer(app);
var io = require('/QOpenSys/QIBM/ProdData/Node/bin/node_modules/socket.io').listen(server);
var conf = {"port": 8020};
app.use("/css", express.static(__dirname + '/css'));
app.get('/', function(request, response) {
response.sendfile(__dirname + '/html/index_chat.htm');
});
server.listen(conf.port);
io.sockets.on('connection', function(socket) {
socket.emit('chat', {zeit: new Date(), text: 'You are connected with the server!'});
socket.on('chat', function(data) {
io.sockets.emit('chat', {zeit: new Date(), name: data.name || 'Anonym', text: data.text});
});
});
console.log('Server running:' + conf.port + '/');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment