Make usable as node module or http server

Change-Id: I3b7cf6e5e8b815254138b8267b1676a197859805