jacwright / RestServer

A PHP REST server for providing a very light-weight REST API.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

404 when new function is added

emoran opened this issue · comments

Hi,

I'm having problems adding a new function in my code, the test or main is working good but when I created a new GET function and test it with postman I'm getting 404 error. This is how my function looks like:

        /**
         * Get all customers functions
         *
         * @url GET /customers/$id
         */
        public function getCustomers{
            return "customer information working...";
        }

It happens also if I use a POST method. There's something additional I need to to or implement?

Thanks in advance,

commented

try adding

$server = new Jacwright\RestServer\RestServer('debug');
$server->refreshCache(); // <----- this line here

Thanks @designstorming still not working, root path is working great, but this new one I can see it exposed.

commented
public function getCustomers{
            return "customer information working...";
        }

Have you added parentheses?

public function getCustomers($id){
            return "customer information working...";
        }

Also check if .htaccess is present as @jacwright described

Thanks again @designstorming I just modified my httpd.config adding:

<Directory "my_directory_where_my_project_is_hosted">
    AllowOverride All
    Order allow,deny
    allow from all
</Directory>

And now is working fine,