The backend api calls in the frontend should only happen through services
See original GitHub issueWe expect all the backend API calls should happen through a service but currently there exist multiple directives that make http request. This issue focuses on refactoring directives such that they don’t make any HTTP requests.
Tips on how to resolve this issue:
Assume a directive makes an http call to URL \someurl\andsomethingmore
- Check whether there exists any service which makes this calls, if yes then use the existing service in the directive
- You can do this through
git grep "someurl\and"
and check for a service.ts file.
- You can do this through
- If there isn’t any existing service that makes this call then create a new *-backend-api.service.ts file and use that service in the directive. The new service should be written in angular, please follow this doc that describes how to write such service.
Please contact @srijanreddy98 if you have any questions about this issue.
PR’s for reference: #8061
To be assigned to a file or for any queries, comment on the thread and tag @DubeySandeep
The files listed below should be refactored with for the expected behavior:
- core/templates/services/translation-file-hash-loader-backend-api.service.ts @tpapesh
- core/templates/pages/exploration-editor-page/editor-tab/templates/modal-templates/teach-oppia-modal.controller.ts
- core/templates/components/entity-creation-services/story-creation.service.ts
Note: For a guide on how to access Oppia’s webpages, see this.
Issue Analytics
- State:
- Created 4 years ago
- Comments:70 (52 by maintainers)
Top Results From Across the Web
HTTPs calls in frontend should only happen through *backend ...
We are expecting to make all the https class from a backend-api.services (like this question-backend-api.service.ts).
Read more >Should I make 3rd party API calls in backend or frontend?
Generally I would recommend always making the 3rd party calls from the back end. It gives you more control and avoids any cross...
Read more >Distinction between API and frontend-backend
the API is the agreed way that the front-end and back-end will work together. This is structurally implied with matching code, and explicitly...
Read more >Where does an API come in on front-end and back-end? - Quora
A REST API service usually comes ad a medium/”interface” for the frontend to consume data served from backend. Sometime even the backend uses...
Read more >How Does the Frontend Communicate with the Backend?
Once the HTML and JS has arrived at the browser, the JS is executed and starts making requests to the server for DATA....
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Okay, @mridul-netizen please assign me
story-creation.service.ts
Thanks.@MohdImran001 I’ve assigned you to
extensions/interactions/EndExploration/directives/oppia-interactive-end-exploration.directive.ts
, you can use the existing ExplorationSummaryBackendApiService.loadPublicAndPrivateExplorationSummaries function instead of creating a new backend API service. Let me know if you need any help! 😃@jay24rajput Welcome to Oppia! I’ve assigned you to
core/templates/pages/preferences-page/preferences-page.component.ts
, you can create a function in the existing UserBackendApiService (instead of creating a new file). Let me know if you need any help! 😃 [I found thatcore/templates/dev/head/pages/creator-dashboard-page/creator-dashboard-page.controller.ts
is already resolved so assigned you to another part of this issue, I hope that’s fine!]