l3est
l3est

Reputation: 417

AdonisJS single route won't open

I've made this project with AdonisJS, this is PlaceController file content:

async create({
    view
  }) {
    return view.render('places.new')
  }

and this is view file path: views/places/new.edge which is a simple static HTML file.

and the routes.js file content:

Route.get('admin/places/new', 'PlaceController.create')

when I enter the URL in browser, the URL just disappears.the problem solves by removing admin from route. Is there a bug in this framework or am I doing something wrong?

Upvotes: 0

Views: 319

Answers (1)

l3est
l3est

Reputation: 417

So problem solved. another Route caused this problem. it was

Route.get('admin/places/:id', 'PlaceController.edit').middleware(['admin'])
Route.get('admin/places/new/', 'PlaceController.create').middleware(['admin'])

changed the order to:

Route.get('admin/places/new/', 'PlaceController.create').middleware(['admin'])
Route.get('admin/places/:id', 'PlaceController.edit').middleware(['admin'])

now it works.

Upvotes: 2

Related Questions