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 -

performance - Why is XCHG reg, reg a 3 micro-op instruction on modern Intel architectures? -

jquery - Responsive Navbar with Sub Navbar -