I am creating a small Angular 2 application with a php based REST API. The way I have been developing it so far is I created mock data in a json file and used that to create the front end. I created the php REST API using MAMP and tested it separately and it works fine. The problem I am having is I would like to test the integration of both of them but when I run the npm lite server and try to make an HTTP request to the API it doesn't work. Is there a npm server I can use instead of the lite-server that would run the php API? Or is there another solution I am completely overlooking?
2 Answers
I actually found one solution. So I can enable CORS on my local MAMP server by editing the Apache configuration file. In case anybody needs to do something similar here is a very short tutorial on how to do the same:
http://enable-cors.org/server_apache.html
This works great for my needs.