©  Caio Ribeiro Pereira 2016

Caio Ribeiro Pereira, Building APIs with Node.js , 10.1007/978-1-4842-2442-7_11

11. Preparing the Production Environment

Caio Ribeiro Pereira

(1)São Vicente - SP, São Paulo, Brazil

Cross-origin resource sharing (CORS) is an important HTTP mechanism. It is responsible for allowing or denying asynchronous requests from other domains.

CORS , in practice, includes only the HTTP headers that are included on the server side. Those headers can indicate which domain can consume the API, which HTTP methods are allowed, and, mainly, which endpoints can be shared publicly for applications from other domains to consume. Generally when implementing CORS in a browser, each cross-origin request will be preceded by an OPTIONS request ...

Get Building APIs with Node.js now with the O’Reilly learning platform.

O’Reilly members experience live online training, plus books, videos, and digital content from nearly 200 publishers.