This issue about Routing. Because while I was trying to make post requests, I get errors.
While I was trying to make post requests in AdonisJS, I get error. For example
localhost:3333/phones => requests came from directly post, ajax or postman after request I got 403 error.
Router
const Route = use('Route')
Route.get('/', 'HomeController.index');
Route.post('phones', 'PhoneController.store');
Controller
'use strict'
class PhoneController {
* store(request, response) {
console.log("...")
}
}
Only output: 403
There is no any other output about error.
There is no any other screenshot about this error.
Ok. I solved :) When I'm looking for config files I found shield.js files.
If I use like this it works
csrf: {
enable: false,
methods: ['POST', 'PUT', 'DELETE'],
filterUris: [],
compareHostAndOrigin: true
}
with this way you just close the csrf protection
For those still looking for this in the future. Drop a csrf field into your html form by using:
{{ csrfField() }}
The docs can be found in the security section here.
This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.
Most helpful comment
Ok. I solved :) When I'm looking for config files I found shield.js files.
If I use like this it works