getting require all fixed up and setting default payload data with middleware function