expressJs middleware pattern emulation