This below is my index.js, the file where i'm trying to call an imported function
const mysyn = require('./syntax.js')
router.post("/",(req,res)=>
{
var code = (req.body.Code);
console.log(syn(code));
res.send("POST")
}
);
and this is syntax.js:
const syn = function(code)
{
console.log("In sep html"+ code );
}
module.exports = syn;
I tried using ES6 import statement but that didn't work since node throws back the 'Unexpected token {' error. So, How do I come across this?