Epilogue (npm module for Sequelize ORM rest endpoints) is only 5 months old hence the sparse documentation but I was wondering how to work with this sample middleware module that was on it's npm page https://www.npmjs.com/package/epilogue
Console error read
return context.continue;
^^^^^^
SyntaxError: Unexpected token return
I'm trying to add middleware for authentication and I'm new to node/js and just pasted the sample code to start with, and I'm not sure how to work with this.
// middleware.js
module.exports = {
create: {
fetch: function(req, res, context) {
// manipulate the fetch call
console.log('Request URL:', req.originalUrl);
next();
}, function (req, res, next) {
console.log('Request Type:', req.method);
next();
}
return context.continue;
}
},
list: {
write: {
before: function(req, res, context) {
// modify data before writing list data
return context.continue;
},
action: function(req, res, context) {
// change behavior of actually writing the data
return context.continue;
},
after: function(req, res, context) {
// set some sort of flag after writing list data
return context.continue;
}
}
}
};