- Building Microservices with Go
- Nic Jackson
- 120字
- 2021-07-15 17:28:13
Accessing APIs from JavaScript
Web browsers implement a sandbox mechanism that restricts resources in one domain from accessing resources in another. For example, you may have an API that allows the modification and retrieval of user data and a website that provides an interface for this API. If the browser did not implement the "same-origin policy" and assuming the user did not log out of their session then it would be possible for a malicious page to send a request to the API and modify it without you knowing.
To get around this, there are two methods that can be implemented by your microservice to allow this access, JSONP which stands for (JSON with Padding) and CORS (Cross-Origin Resource Sharing).
推薦閱讀
- 潮流:UI設計必修課
- C語言程序設計基礎與實驗指導
- ASP.NET Core 2 and Vue.js
- 面向STEM的Scratch創新課程
- Visual Basic程序設計教程
- Java Web程序設計
- 零基礎學Python數據分析(升級版)
- Symfony2 Essentials
- MATLAB for Machine Learning
- .NET 3.5編程
- FPGA Verilog開發實戰指南:基于Intel Cyclone IV(進階篇)
- QGIS Python Programming Cookbook(Second Edition)
- Mastering Docker
- Mastering Adobe Captivate 7
- AI自動化測試:技術原理、平臺搭建與工程實踐