How can I return a view and display it through the controller in AdonisJs
'use strict'
class PostController {
index(){
return view.render('welcome')
}
}
module.exports = PostController
report this error:
ReferenceError
view is not defined
You can use response.send(view.render('<your_view>'))
Something like:
...
index({ response, view }){ // Get objects from HTTP Context
return response.send(view.render('welcome'))
}
HTTP Context documentation
Official forum answer
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With