ikaras / yii2-oauth2-rest-template

Yii2 Rest APi Template with OAuth2 server

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

I get 404 on each request

bdart opened this issue · comments

I followed the instructions and everything is going fine / installation/ db connection / migration than I tried this in terminal:
curl -i -H "Accept:application/json" -H "Content-Type:application/json" "http://api.loc/v1/products"

Maybe I am just foolish but I do not get to the point why it cannot find something.

The only thing that is different that I do not use api.loc instead I use the real path after localhost to the directory.

Hi, @bdart.
Interesting.
Tell me please request's url. If it view like this: http://localhost/app/application/api/v1/products - it's wrong.
You need to configure app to separate virtual host. See how here: http://www.yiiframework.com/doc-2.0/guide-start-installation.html#configuring-web-servers

It looks like this:
curl -i -H "Accept:application/json" -H "Content-Type:application/json" "localhost/api.loc/v1/products"

api.loc looks in the wanted directory: .../application/api/www

As I thought, you need to configure the separate virtual host on your server for code. The request url should be like: http://api.loc/v1/products (api.loc is the your custom local domain, it can be everything you want: api.com, rest.by, etc).

To see how it to do, please, look at my previous comment.

Now I got it working thank you very much for your patience