- node app.js
- running in: http://localhost:3000/
- I have used lesscss only in my stylesheet
public/css/styles.less
because I couldn't find the less files of the bootstrap 2.3.2. Now, it's released the new version bootstrap 3. - My knockout app is in
public/js/app.js
. - When the app renders the html file, it passes as hardcoded the list of publications but the list doesn't effect the application. I did that in order to create 2 versions. The first one should have run in full ajax implementation and the second one should have load the list by one less request from the server. So, just ignore this part
window.publications = [...];
. - Field
Channels
: I have created endpoint which provide a hardcoded list of channelshttp://localhost:3000/channels
file: routes/publication.js
-> middleware: this.sendNewPublication
// trigger publication:new for websocket
app.emit('publication:new', {
version : app.VERSION,
response : req.publication,
status: req.error ? 'ERROR' : 'OK',
error: req.error
});
There is a listener at file: app.js
io.sockets.on('connection', function (socket) {
app.on('publication:new', function (data) {
setTimeout(function() {
socket.emit('newPublication', data);
}, 2000);
});
app.on('impressions:new', function (data) {
socket.emit('newImpressions', data);
});
});
public/js/chart.js
public/css/chart.less
The same as above. If you want to check the result you can do a request http://localhost:3000/get_new_impressions
and see the results.