General purpose middleware layer for nodejs