- 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).
推薦閱讀
- Practical Data Analysis Cookbook
- MongoDB for Java Developers
- Getting Started with CreateJS
- Building Mobile Applications Using Kendo UI Mobile and ASP.NET Web API
- Flash CS6中文版應用教程(第三版)
- 精通Python自然語言處理
- Solr Cookbook(Third Edition)
- Unity 2018 Shaders and Effects Cookbook
- Python網絡爬蟲技術與應用
- PrimeFaces Blueprints
- Python計算機視覺和自然語言處理
- 青少年學Python(第2冊)
- 零基礎學C++(升級版)
- 計算語言學導論
- 計算機組裝與維護(第二版)