refine code, config the port, support query string for view