Introduction to CORS

CORS is an HTTP-based mechanism that lets you request data from one URL to a different URL.

Let's talk about it in a bit more detail. πŸ§΅πŸ‘‡πŸ»
CORS stands for Cross-Origin Resource Sharing.

Half of the definition is clear by the abbreviation. CORS allows a server to share resources with browsers having different origins.
Let's try to understand cross-origin requests via an example:

Suppose you're making an HTTP request from "a .com" to "b .com". That's a cross-origin request.
Often, you get an error while you're trying to request from a different URL.

This happens because browsers implement a same-origin policy for security reasons in which clients can make requests to the same origin without any errors. same-origin policy
Fun Fact: πŸ’‘

Popular XMLHttpRequest and the Fetch API that we all have been using for a while follow the same-origin policy.

Moving forward πŸ‘‡πŸ»
πŸ“Œ How CORS Works

The server adds the `Access-Control-Allow-Origin` header in the response, which must be the same as the `Origin` header of the request. If this is not the case, the browser will prevent the data from being shared with the client.
A few HTTP request methods cause side effects on the server, and these types of request methods must be pre-flighted.

Let's see what exactly Preflighted requests are πŸ‘‡πŸ»
πŸ“Œ Preflighted requests

The browser first sends the OPTIONS HTTP request to the server to ensure the actual request is safe to send.

In response, the server sends the `Access-Control-Allow-Methods` header with the allowed HTTP request methods values.
For better understanding, take a look at this infographic πŸ‘‡πŸ» preflight request
With that being said, that's pretty much it for this thread.
Give it a retweet if you think this might be helpful for someone. Follow us @Rapid_API for more excellent content. πŸ˜‰

β€’ β€’ β€’

Missing some Tweet in this thread? You can try to force a refresh
γ€€

Keep Current with RapidAPI

RapidAPI Profile picture

Stay in touch and get notified when new unrolls are available from this author!

Read all threads

This Thread may be Removed Anytime!

PDF

Twitter may remove this content at anytime! Save it as PDF for later use!

Try unrolling a thread yourself!

how to unroll video
  1. Follow @ThreadReaderApp to mention us!

  2. From a Twitter thread mention us with a keyword "unroll"
@threadreaderapp unroll

Practice here first or read more on our help page!

More from @Rapid_API

29 Oct
Everything you need to know about HTTP-based systems.

It is a communication protocol that establishes the connection between web browsers and web servers.

Thread πŸ§΅πŸ‘‡πŸ»
HTTP is entirely based on the client-server model, where the client initiates the request then waits until it receives a response from the server.
Typically, there are 3 main components in the HTTP-based system. πŸ‘‡πŸ» Components of an HTTP-based system.
Read 18 tweets
28 Oct
Here are Top 5 Image Search and Image Recognition APIs you can use in your next project.

Thread πŸ§΅πŸ‘‡πŸ»
1️⃣ Imgur

- Imgur is an online image sharing and image hosting service. Imgur’s API exposes the entire Imgur infrastructure via a standardized programmatic interface.

πŸ”— RapidAPI.com/imgur/api/imgu…

πŸ“ˆ Popularity: 9.9/10
πŸ•› Latency: 251ms
βœ… Service Level: 100%
2️⃣ Web Search

- Billions of webpages, images and news with a single API call.

πŸ”— RapidAPI.com/contextualwebs…

πŸ“ˆ Popularity: 9.8/10
πŸ•› Latency: 1,634ms
βœ… Service Level: 99%
Read 6 tweets
27 Oct
Building an Artificial Intelligent application is a tedious task.

We bring you the top 5 Artificial Intelligence APIs to build excellent full-stack applications.

A Thread πŸ§΅πŸ‘‡πŸ»
1️⃣ BOTlibre

- BOT libre allows you to create your artificial intelligent chatbot, train them, and share them with others.

πŸ”— RapidAPI.com/paphus/api/bot…

πŸ“ˆ Popularity: 8.4/10
πŸ•§ Latency: 1,128ms
βœ… Service Level: 100%
2️⃣ Sentiments

- Sentiments API returns the sentiment score of any given text.

πŸ”— RapidAPI.com/connexun-srl-c…

πŸ“ˆ Popularity: 6.1/10
πŸ•§ Latency: 772ms
βœ… Service Level: 92%
Read 6 tweets
27 Oct
A quick Introduction to API πŸ–‡οΈ

The following ten tweets will give you an agile intro to API if you're new to the API development world.

A Thread πŸ§΅πŸ‘‡πŸ»
πŸ“Œ Definition

API is the acronym for

Application
Programming
Interface

API is a set of definitions and protocols that allow two computers to talk to each other.
πŸ“Œ Real-time example of an API

Suppose you're building an app in which you need to validate the users' email id.

Steps you can do so πŸ‘‡πŸ»

- Check the format of the string (does it have an @ sign?)
- Ping domain to validate running to the email server
- Check blocklists, etc
Read 13 tweets
26 Oct
You must have heard of the term RESTful API.

Let's try to get a quick introduction to the REST API in the following ten tweets.

A Thread πŸ§΅πŸ‘‡πŸ»
Before jumping onto REST

An API is an Application Programming Interface that lets you connect two computers, where one computer or application requests the data from the server.
RESTful APIs are the most famous type of API.

REST APIs are APIs that follow standardized principles, properties, and constraints.

You can access resources in the REST API using HTTP verbs. πŸ‘‡πŸ»
Read 12 tweets
25 Oct
Top 5 Finance APIs you can use in your next project.

A Thread πŸ§΅πŸ‘‡πŸ»
1️⃣ Alpha Vantage

- The simplest and most effective way to receive stock, ETF, forex, technical indicators, and cryptocurrency data.

πŸ”— rapidapi.com/alphavantage/a…

πŸ“ˆ Popularity: 9.9/10
πŸ•› Latency: 577ms
βœ… Service Level: 100%
2️⃣ Currency Converter

- Provides exchange rates based on the official bank's data.

πŸ”— rapidapi.com/natkapral/api/…

πŸ“ˆ Popularity: 9.8/10
πŸ•› Latency: 173ms
βœ… Service Level: 100%
Read 6 tweets

Did Thread Reader help you today?

Support us! We are indie developers!


This site is made by just two indie developers on a laptop doing marketing, support and development! Read more about the story.

Become a Premium Member ($3/month or $30/year) and get exclusive features!

Become Premium

Too expensive? Make a small donation by buying us coffee ($5) or help with server cost ($10)

Donate via Paypal Become our Patreon

Thank you for your support!

Follow Us on Twitter!

:(