Cannot add root url route

#1

Hi guys… look at my routes.js

Route.get('/', 'SessionController.hasValidSession')

Route.on('login').render('login')

Route.post('users', 'UserController.create');

Route.post('login', 'SessionController.create');

Route.get('logout', 'SessionController.logout')

Route.resource('students', 'StudentController')
.apiOnly()
.middleware('auth')

Route.resource('admissions', 'AdmissionController')
.apiOnly()
.middleware('auth')

Route.resource('payments', 'PaymentController')
.apiOnly()
.middleware('auth')

Route.get('students-list', 'CustomQueryController.getStudentsReport')
.middleware('auth')

Route.any('*', ({ view }) => view.render('error404'))

I have an issue with the root url route, he is not calling the method SessionController.hasValidSession, the server just respond with de main page, if I comment this line, the response continue the same.

What I’m doing wrong?

0 Likes

#2

This is your entire routes.js file?

0 Likes

#3

Yeap, why?

0 Likes

#4

Can we see your SessionController.hasValidSession action?

0 Likes