so, I was using express-toastr package on my application. Whenever i try to run the programme it gives me this error
C:\Users\Johaa Jnr\Desktop\loginApp\node_modules\express-
toastr\index.js:71
req._toasts = [];
^
TypeError: Cannot set property '_toasts' of undefined
here's my app.js code
...
var session = require('express-session')
var cookieParser = require('cookie-parser')
var path = require('path')
var cors = require('cors')
var flash = require('connect-flash')
var toastr = require('express-toastr')
app.use(express.static(path.join(__dirname, 'public')))
app.use(express.urlencoded({ extended: false }))
app.use(cookieParser())
app.use(express.json())
app.use(session({
secret: 'keyboard cat',
resave: false,
saveUninitialized: false,
cookie: { secure: false }
}))
app.use(flash())
app.use(toastr())
...
and here's my route
Router.get('/', csrfProtect, (req,res)=>{
var qry = req.query.q
if(qry){
req.toastr.error(qry)
}
res.render('signup', { req: req, csrfToken: req.csrfToken() })
})
I dont have the idea what am I doing wrong here? any solution to this problem ?