I'm getting this error
[11:55:38] Unexpected token => at test.js :
175 | // }
176 | })
177 | var f = (req, res, next) => {
------------------------------------^
178 | return res.json('test');
179 | };
When running this specific code.
var f = (req, res, next) => {
return res.json('test');
};
app.get('/test', f);
I'm playing around with ES6 and I can't find a solution for this error even though my route was working properly and returning 'test'.
What is the problem with this snippet?
'use strict';
module.exports.controller = function (app) {
app.get('/test', (req, res, next) => {
return res.json('test');
});
}
test), when its having error "Unexpected token => at test.js"?