Loading .gitignore +2 −0 Changes for .gitignore: 2 added lines, 0 removed lines. Original line number Diff line number Diff line Loading @@ -3,9 +3,11 @@ config/autoload/local.php config/autoload/unicaen-app.local.php config/autoload/unicaen-auth.local.php # Connecteurs /config/connectors/*.yml !/config/connector/*.yml.dist socket/config.json # Documentation /doc/*.pdf Loading socket/config.json.dist 0 → 100644 +12 −0 Changes for socket/config.json.dist: 12 added lines, 0 removed lines. Original line number Diff line number Diff line { "bdd": { "user": "oscar_empty", "host": "localhost", "base": "oscar_empty", "pass": "azerty" }, "socket": { "port": 3000, "push_path": "/scr2a548f96E712v54398560125408795" } } No newline at end of file socket/server.js +8 −7 Changes for socket/server.js: 8 added lines, 7 removed lines. Original line number Diff line number Diff line Loading @@ -2,7 +2,8 @@ var app = require('express')(); var http = require('http').Server(app); var io = require('socket.io')(http); var pg = require('pg'); var bodyParser = require('body-parser') var bodyParser = require('body-parser'); var config = require('./config.json'); app.use( bodyParser.json() ); // to support JSON-encoded bodies app.use(bodyParser.urlencoded({ // to support URL-encoded bodies Loading @@ -16,13 +17,13 @@ app.get('/', function(req, res){ res.sendFile(__dirname + '/index.html'); }); app.post('/push', function(req, res){ app.post(config.socket.push_path, function(req, res){ var ids = req.body.ids.split(','); var client = new pg.Client({ user: 'oscar_empty', host: 'localhost', database: 'oscar_empty', password: 'azerty' user: config.bdd.user, host: config.bdd.host, database: config.bdd.base, password: config.bdd.pass }); client.connect(); client.query('SELECT * FROM notification WHERE id IN(' +ids.join(',') + ')', function(err, result){ Loading Loading @@ -109,6 +110,6 @@ io.on('connection', function(socket){ } }); http.listen(3000, function(){ http.listen(config.socket.port, function(){ console.log('listening on *:3000'); }); No newline at end of file Loading
.gitignore +2 −0 Changes for .gitignore: 2 added lines, 0 removed lines. Original line number Diff line number Diff line Loading @@ -3,9 +3,11 @@ config/autoload/local.php config/autoload/unicaen-app.local.php config/autoload/unicaen-auth.local.php # Connecteurs /config/connectors/*.yml !/config/connector/*.yml.dist socket/config.json # Documentation /doc/*.pdf Loading
socket/config.json.dist 0 → 100644 +12 −0 Changes for socket/config.json.dist: 12 added lines, 0 removed lines. Original line number Diff line number Diff line { "bdd": { "user": "oscar_empty", "host": "localhost", "base": "oscar_empty", "pass": "azerty" }, "socket": { "port": 3000, "push_path": "/scr2a548f96E712v54398560125408795" } } No newline at end of file
socket/server.js +8 −7 Changes for socket/server.js: 8 added lines, 7 removed lines. Original line number Diff line number Diff line Loading @@ -2,7 +2,8 @@ var app = require('express')(); var http = require('http').Server(app); var io = require('socket.io')(http); var pg = require('pg'); var bodyParser = require('body-parser') var bodyParser = require('body-parser'); var config = require('./config.json'); app.use( bodyParser.json() ); // to support JSON-encoded bodies app.use(bodyParser.urlencoded({ // to support URL-encoded bodies Loading @@ -16,13 +17,13 @@ app.get('/', function(req, res){ res.sendFile(__dirname + '/index.html'); }); app.post('/push', function(req, res){ app.post(config.socket.push_path, function(req, res){ var ids = req.body.ids.split(','); var client = new pg.Client({ user: 'oscar_empty', host: 'localhost', database: 'oscar_empty', password: 'azerty' user: config.bdd.user, host: config.bdd.host, database: config.bdd.base, password: config.bdd.pass }); client.connect(); client.query('SELECT * FROM notification WHERE id IN(' +ids.join(',') + ')', function(err, result){ Loading Loading @@ -109,6 +110,6 @@ io.on('connection', function(socket){ } }); http.listen(3000, function(){ http.listen(config.socket.port, function(){ console.log('listening on *:3000'); }); No newline at end of file