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
Advertisement
Answer
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')) }