php - Laravel 5.4: Method not allowed for post -
i'm starting creating api, testing routes. here routes/api.php:
route::get('/', 'apicontroller@index'); route::post('/foo', 'apicontroller@store'); and apicontroller.php
public function index() {    return 'hello, api'; }  public function store() {     return 'api post'; } on postman, method works. post return 405 code.
there no restriction on http/kernel.php:
protected $middlewaregroups = [     'web' => [        ...     ],      'api' => [         'throttle:60,1',         'bindings',     ], ]; 
use /api/foo not /api/foo/. because if using apache , check in access log moved permanently get /api/foo.

Comments
Post a Comment