I have an angular2 app, and its hitting an api which is placed in my wamp/www . When i try to hit the api i get this error.
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
<html><head>
<title>404 Not Found</title>
</head><body>
<h1>Not Found</h1>
<p>The requested URL /usmanproject/api/web/v1/users was not found on this server.</p>
<hr>
<address>Apache/2.4.9 (Win64) PHP/5.5.12 Server at localhost Port 80</address>
</body></html>
My angular app is running on localhost:4200and the angular project folder is also placed in wamp/www but it is not working.
This is my angular code
private heroesUrl = 'http://localhost/usmanproject/api/web/v1/users?access-token=n-EJtZiejtz5RSVWe-U14G4kCnPWMKf0'; // URL to web api
private headers = new Headers({ 'Content-Type': 'application/x-www-form-urlencoded' });
create(): Promise<any> {
return this.http
.get(this.heroesUrl)
.toPromise()
.then(res => res.json().data)
.catch(this.handleError);
}
The backend is made in yii2. I have tested the apihttp://localhost/usmanproject/api/web/v1/users?access-token=n-EJtZiejtz5RSVWe-U14G4kCnPWMKf0 in postman, its working perfectly fine over there.
I have an angular2 app, and its hitting an
api
which is placed in mywamp/www
. When i try to hit the api i get this error.My angular app is running on
localhost:4200
and the angular project folder is also placed inwamp/www
but it is not working.This is my angular code
The backend is made in
yii2
. I have tested theapi
http://localhost/usmanproject/api/web/v1/users?access-token=n-EJtZiejtz5RSVWe-U14G4kCnPWMKf0
in postman, its working perfectly fine over there.