I am new to .js and want to change this arrow function to normal function, for personal interest
module.exports.endpoint = fn =>
(req, res) => {
Promise.resolve(fn(req, res))
.catch((err) => {
this.jsonOutHandler(err, null, res);
});
};
How to achieve it?
functionin front, surround the parameter(s) in brackets (here it's justfn), remove the=>, add{ }around the body and areturn.= function(fn) { return function(req, res) {etc