hasib32 / rest-api-with-lumen

Rest API boilerplate for Lumen micro-framework.
487 stars 143 forks source link

Getting 404 on every request #38

Closed pattle closed 7 years ago

pattle commented 7 years ago

First of all thanks for putting this boilerplate together.

I've gone through the setup guide but I keep getting 404's on every request. I'm not running the project using homestead, instead I want to be able to just go to http://localhost/project-name/public but this returns a 404.

Am I missing a step? Any help is greatly appreciated.

hasib32 commented 7 years ago

Hi, public is not a valid api endpoint/resource. only valid endpoint is users

pattle commented 7 years ago

Thanks for the quick response. If I remove the public I just get a directory listing as the index.php is in the public folder

hasib32 commented 7 years ago

try http://localhost/project-name/users. and how are you running the application?

pattle commented 7 years ago

That gives me the apache not found page rather than a JSON response. I'm just running the project using WAMP on Windows. In your tutorial your base url is http://restapi.app but because I'm not using vagrant and homestead mine should just be http://localhost/project-name/public.

Do you think it could be a .htaccess problem?

hasib32 commented 7 years ago

Try running php artisan serve it should give you an url.

pattle commented 7 years ago

I think the serve command has been removed but if I run php -S localhost:8080 -t public/ the application now works.

Do you know why this now works? I'm worried that if I deploy to production I'm going to have the same problem but no understanding of why it's happening.

hasib32 commented 7 years ago

Before you did not have any server. Now, you are running the application with built in php server.