I am working on a frontend project and need to develop a frontend for an already existing backend developed in PHP. I need to extract all the endpoints from the server code and build the frontend accordingly. I need to know where exactly the endpoints are created or listed in PHP code so that I can understand their payload and header requirements.
Related
I'm a noob at REST API and anything concerning proper etiquette of frontend/backend communication so I apologize in advance if this is some very basic stuff.
I have a single-page React application that's hosted with Github Pages.
The backend with the rest API is hosted on Heroku.
As placeholders I'll refer to the main application URL as https://frontend.com
and the backend endpoint as https://backend.com
The REST API is configured at two endpoints https://backend.com/api/get and https://backend.com/api/post
I'm currently trying to make it so these endpoints can be accessed/fired from the frontend url so something like:
https://frontend.com/api/get
https://frontend.com/api/post
I'm struggling to make this work given the constraint of it being a single-page application, and anything attempt at trying to directly access any other endpoint but the index is met with an error 404: page not found.
Is this possible to accomplish with how things are set up currently?
I have a nextjs app that I'm using to process stripe payments that I've deployed to Vercel. The app is simply a form with tons of functionality built in but requires the use of an api (which is why I'm using nextjs). What is the best way to get this into a php site? I need to access the nextjs api in order to communicate with stripe. Otherwise I would have just built the react app in the php site and rendered it on the page in question per usual. I've never done this before, so please any recommendations would be huge.
Here are the options I've come up with:
iframe. I've never been a huge fan of these, but figured this was an option. I can render my app via iframe on the php site.
use the vercel deployed nextjs app strictly for the api and build the react form into the php site. Then I would simply change the api requests to point to the vercel deployed nextjs app instead of a local api.
Are there better more efficient methods?
Try vercel-php, a PHP runtime for Vercel. Using the configuration described in the README, you can use a PHP repository as your backend and fetch data from there for your NextJS app.
Alternatively, you can use this directly in your NextJS repository and instead of having the api folder inside the pages directory, just have it as a top-level directory
I have build an app with vue (not with vue cli). I ran It on my local host. What I am trying to do is to add php in this Project. But I cannot run php and vue on the same local host together. Is there a way to solve this problem ?
I know when the app is created with command line interface you can compile them with webpack. But how to combine back-end and front-end together when the app is created with vue?
Thanks a lot in advance
Vue is a javascript framework and I suppose you are familiar with javascript. In javascript, we use AJAX to interact with PHP. we used to send POST and GET request to the server via ajax and javascript and we get the response from the server.
In a similar way, you need to learn how to create Rest API for GET and POST via vueJS and PHP.
You Need to create Rest API for VueJS and PHP. There is no other solution. follow the links below as per your need.
Here is the Github Link for the Same
You can also use Laravel framework with Vue
Hi I am building an application based on Magento CE 1.9.2
I have previous experience with magento but not recently or experience using the API, either SOAP or REST.
I am trying to decide whether or not it is fully beneficial or it is recommended to to abstract the client allow a fully fledged e-commerce store using an angular client / magento.
I am trying to see if it efficient to integrate AngularJs within Magento or have an Angular client making calls to the Magento API.
I have found this resource and i am investigating:
https://github.com/Wildhoney/Magento-on-Angular
This seems like an interested libary but before i start i wanted to see what the limitations where for accessing data through either SOAP or REST.
Specially as i am building this application for a client who requires the basic shoping aspects and noting to advanced, is there any data / functionality which magento would not be able to send to the client to utilise?
I wish to have the angular client ( this can be on a PHP based app such as laravel like in Magento-on-angular), i need to be able to get all the products, post reviews and interact with say magento modules, modules which work with say instragram and pull down the review pictures which will be sent to a client, i wish to make a full angular checkout and simply post a checkout object (something alone those lines) to magento for it to parse.
my objective is to have a minimal client which does not lack in functionality and i am very proficient in angular, angular was chosen due to the front end requirements of the application.
Or any other constraints or advice?
Or a Pro's / Con's List.
Thanks
Hi I have recently began to build mobile open cart sites for mobile browsers. I would like to take it a step further and build native apps using phonegap. My question is , does phonegap support a structure like opencart? Are php files supported?
Would it be possible for me to build a fully functioning opencart site and integrate it successfully with phonegap?
There is very little information online regarding this question.
A Phonegap app cannot contain any server side scripting like PHP. It can only contains HTML, css and Javascript.
But you can always do request to a remote server that runs PHP.
Opencart has quite a few ajax interfaces in various parts of the app. These call controllers that deliver sections of a page usually. I have not looked into the full remote API to know if you can build a full shop app that uses the opencart backend.
If you look down that ajax calls path you may find enough functionality to produce the phonegap app.