I have a function that takes all the routes registered in the express and registers these routes in the bank using Sequelize.
app._router.stack.forEach(function(r){
// console.log(r.route.path)
if (r.route && r.route.path){
var str = r.route.path;
var ress = str.split("/");
if(ress[ress.length-1].startsWith(':')){
rota = ress.pop()
method_temp = operacoes['${ress.join("/")}']
if(method_temp){
let x = Object.keys(r.route.methods)
x.forEach(function(y){
operacoes['${ress.join("/")}'].add(y)
})
}
}else{
operacoes['${ress.join("/")}'] = new Set(Object.keys(r.route.methods))
}
}
})
I would like instead of having to access a route, I could take these routes registered in the Seed and insert in the database so that I could use the Sequelize CLI and later create another seed to create the initial users associated with those routes.
The difficulty is: I can not access anything from the application in Seed. It appears to run separately and does not communicate with the General application.