Refractored expressjs from server