angularjs - Grunt serve + PHP? -


I'm starting my first project with yo + grunt + angular.js.
I have a service that requires reading some data from my server; I created it using the Angular $ http service. I have implemented a permanent web service (PHP, but this is Java, C, Perl, maybe ... it does not make any difference) that reveals the API to get the data.
The server with which the victim works in my NG-App is currently (and probably will ever be) in the same way where the PHP Web service (via Apache) runs.

I am surprised that this is an acceptable architecture ... I end up getting two different servers (Billing and Apache) on the same server ... and, always the output of my PHP service To add "access-control-permission-permission-origin-127.0.0.1" ...: - (

Is it possible to serve suffering from periods, for example?

UPDATE : I speak about the stage of development ... Of course, to understand myself better on production ... In order to convince myself, I would like to use the related URL in $ http ... with the same code in both the development and production phases ... if I can expect it to work, because I have an angular app and will have only one server for the e-PHP service, which is going to explain PHP on development, when the angular app is served by grunts? If yes, then How?

UDPpat 2, and And a possible solution : After thinking a lot about this issue (reading more articles), and not receiving satisfactory answers here, I decided that I would use this approach:

  • Development
    • Use a "production-like" server (Apache, Lightweight, ...) to serve the real PHP pages.
      Use the absolute URL of $ http or $ request to access that server (unlike grunts, which shows angular .js pages).
    • Before generating output (JSON) in PSP scripts, always produces a proper "access-control-on-out", which are easy to configure URLs, permissions-origin " Header; The value of the command can also be easily configured.

  • Product
    • Deploy the angular.js app on the same server where PHP is deployed.
    • Change the URL, Make ladders, because now they share the same basic with client-side scripts.
    • The "Access-Control-Allow-Origin" header, to allow only local requests (or possibly those Delete the header all ...).

If someone would like to comment then I would be very happy to dispute this solution, or better Proposals of people ...

Sample day inside the work app folder to solve the problem To create flat files with Ta and to use relative URL with $ resource and $ http and then posted our code as application at the same subdirectory level ... / fx / api / fund was for example < / P>

It still gives pebbles to stabilize something to see that the design will look like an angular app while providing a full experience, after that we have a development server, when we code (Jenkins Use Rte a) the update, we can examine the actual functionality and can run against our test suite.

This approach is a little irritant but it allows us to take advantage of the harsh approach and is still a test server. We also make that we can use the minimum version so that we can check that the app will not be broken.

The only problem with this approach is that in the web server with hours, the post made in the server can not handle requests, so that any caller phone fails.


Comments

Popular posts from this blog

import - Python ImportError: No module named wmi -

Editing Python Class in Shell and SQLAlchemy -

lua - HowTo create a fuel bar -