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',     ], ]; 

enter image description here

use /api/foo not /api/foo/. because if using apache , check in access log moved permanently get /api/foo.


Comments

Popular posts from this blog

Is there a better way to structure post methods in Class Based Views -

reflection - How to access the object-members of an object declaration in kotlin -

php - Doctrine Query Builder Error on Join: [Syntax Error] line 0, col 87: Error: Expected Literal, got 'JOIN' -