- 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).
推薦閱讀
- Mastering Entity Framework Core 2.0
- OpenCV 3和Qt5計(jì)算機(jī)視覺(jué)應(yīng)用開(kāi)發(fā)
- Lua程序設(shè)計(jì)(第4版)
- Magento 1.8 Development Cookbook
- Python面向?qū)ο缶幊蹋簶?gòu)建游戲和GUI
- Unity 2018 Shaders and Effects Cookbook
- 從零開(kāi)始學(xué)C#
- HTML+CSS+JavaScript網(wǎng)頁(yè)制作:從入門到精通(第4版)
- Backbone.js Testing
- Greenplum構(gòu)建實(shí)時(shí)數(shù)據(jù)倉(cāng)庫(kù)實(shí)踐
- Vue.js 3.x高效前端開(kāi)發(fā)(視頻教學(xué)版)
- Hadoop Blueprints
- Spring Boot學(xué)習(xí)指南:構(gòu)建云原生Java和Kotlin應(yīng)用程序
- HTML5 Game Development by Example:Beginner's Guide(Second Edition)
- Raspberry Pi開(kāi)發(fā)實(shí)戰(zhàn)