-
Notifications
You must be signed in to change notification settings - Fork 25
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Use rest api instead of sql statements. #Hacktoberfest #23
Comments
The rest api is available at https://github.com/agnelvishal/Condense.press/tree/master/rest-api |
pull request has been submitted. |
Hello @LegacyStackCrash Will it be possible to use ajax instead of curl? |
@agnelvishal it is possible to produce the same functionality using ajax instead of curl. However I would highly recommend a small refactor if you want to move over to ajax. Additionally some other things to consider is that by moving to an AJAX call you will now be subject to CORS. While this is not an issue when your client and server are on the same host. It can become a little confusing if you choose to serve your server from say "example.com" but then serve your client page from "example2.com". |
By refactor, is it meant that the code for high charts and cards have to be moved from server to client? |
In this case that is correct. Currently your HTML and JS is intertwined with your PHP which is okay for the approach for the way it currently works. However you would not really want to leave the extra overhead of PHP on the client side rendering if you are going to utilize ajax to request the data from the front end. |
So in this case ajax is a bad idea? |
Not necessarily, this is more or less a design decision on your part to determine if you would prefer your server to do the work on gathering data or if you want your client's browser to do the work to gather the data. However if you want to move to your client gathering data(ajax) a small refactor(code rewrite) would be beneficial to your project as you gain no benefit from your db.php once you move to using an Ajax call. I see that you also have an issue open for refactoring to VueJS. When this issue is picked up would be a good time to refactor the way your client is served content from curl to an ajax call. |
As of now, mysql query is used in the php file to interact with the database. A rest api is available but has not been used in the php file. Could someone help?
The text was updated successfully, but these errors were encountered: