These are chat archives for nodejs/node-v0.x-archive

2nd
Jun 2015
Vladislav Kolesnikov
@externuz
Jun 02 2015 10:50
Hi everyone! Anybody knows, how to count data transmitted/received for every request in Express.js or native Node.js http?
Vladislav Kolesnikov
@externuz
Jun 02 2015 11:36
Who knows, why this code do nothing?
app.use(function(req, res, next) {

  res.on('data', function() {
    console.log('data');
  });

  req.on('data', function() {
    console.log('data');
  });

  next();
});
Vladislav Kolesnikov
@externuz
Jun 02 2015 13:36
Should this simple middleware handle EACH request? (GET css, GET js and others from JADE template). Yes? Because it is not
var express = require('express');
var app = express();

app.set('view engine', 'jade');
app.use(express.static(__dirname + '/public'));

// MIDDLEWARE

app.use(function(req, res, next) {
  console.log('URL: ' + req.originalUrl);
  next();
});

// ROUTES

app.get('/', function (req, res) {
  res.render('index');
});


// START SERVER

var server = app.listen(3000, function () {
  var host = server.address().address;
  var port = server.address().port;
  console.log('Example app listening at http://%s:%s', host, port);
});
xtianus79
@xtianus79
Jun 02 2015 18:46
is this a good place to ask npm questions?
Vladislav Kolesnikov
@externuz
Jun 02 2015 18:52
Npm? Why npm?
Andrew Koroluk
@Awk34
Jun 02 2015 18:56
NPM has a Freenode server here: irc://chat.freenode.net/npm
i have no idea how active it is though
so other than that there's this chat and https://github.com/npm/npm/issues
Chose McThing
@lilred
Jun 02 2015 20:06
hey fellas, is there a way I can call Node.js CLI apps from inside Node?
Chose McThing
@lilred
Jun 02 2015 20:12
Also, npm scripts has hooks for publish, install, and start. I'm wondering which one I should use as "build".
basically, I'm confused about the difference between publish and install
xtianus79
@xtianus79
Jun 02 2015 22:21
@lilred publish is to upload your git work to nmpjs.org