Explicación del error de CORS
Seguro que alguna vez te ha pasado. Intentas usar una API o cargar un recurso en una web y te salta el fatídico error de CORS.
¿Por qué ocurre?
Porque estamos intentando acceder a un recurso que está en un dominio diferente al que estamos usando.
En ese caso, es posible que el navegador bloquee la petición por seguridad.
Exacto, CORS es una medida de seguridad para evitar que se hagan peticiones a recursos de otros dominios.
Para solucionar esto, el servidor debe enviar una cabecera con el nombre Access-Control-Allow-Origin e indicar si los dominios que pueden acceder a ese recurso.
Por ejemplo, si queremos que cualquier dominio pueda acceder a un recurso, podemos enviar la cabecera Access-Control-Allow-Origin: *
Pero no siempre es una buena idea, porque estaríamos permitiendo que cualquier dominio pueda acceder a ese recurso.
Lo ideal es que el servidor sólo permita el acceso a los dominios que nosotros queramos.
Por ejemplo, si tenemos una API que queremos que solo pueda ser usada por nuestra web, podemos enviar la cabecera Access-Control-Allow-Origin:
Esta cabecera la lee el navegador y comprobará si el dominio desde el que se está haciendo la petición está en la lista de dominios permitidos.
Si no está, bloqueará la petición y saltará el error de CORS.
En el siguiente diagrama puedes ver cómo funciona el proceso de CORS paso a paso:
¿Necesitas crear una API de prueba para tu web?
¡Con este recurso lo haces en SEGUNDOS!
✓ Endpoints GET/POST/PUT/DELETE
✓ Personaliza los headers y la respuesta
✓ Sin registro y gratuito
¡Acelera tu desarrollo!
→ designer.mocky.io
Mapa con el origen por regiones de los 40 equipos que representarán a Colombia en la 2023 ICPC South America-North Finals (Maratón Regional Latinoamericana 2023).
🎓¡Atención educadores y científicos! Obtén acceso a un Diplomado en Innovación Educativa, asesoría en escritura de artículos científicos y apoyo para publicar en revistas académicas, ¡Ahora en TODO el país!🔬
minciencias.gov.co/sala_de_prensa…
There are lots of online courses out there - but what about ones from top universities?
Well, @manocormen compiled a list of 900 of them. And they're free.
Here are 900 CS courses from the world’s best schools that can help level up your skills.
freecodecamp.org/news/free-cour…
📚10 Microservices Patterns 📚
1. 🔍 Service Registry: This pattern involves managing the locations of services in a distributed system. It maintains a list of all available services and their locations, which can be queried by other services to find and communicate with them.
2. ⚡️ Circuit Breaker: This pattern is used to prevent cascading failures in a distributed system. It monitors the availability of a service and, if it detects a failure, it can quickly isolate the problematic service and prevent other services from being affected.
3. 🚪 API Gateway: This pattern provides a single entry point to a microservices-based system. It acts as a reverse proxy and routes incoming requests to the appropriate microservice. It can also perform authentication, rate limiting, and other security-related tasks.
4. 📝 Event Sourcing: This pattern involves capturing all changes to the state of a system as a series of events. These events can be used to reconstruct the current state of the system at any point in time. This pattern is useful for systems with complex business logic that require auditability, traceability, or compliance.
5. 🎭 Saga: This pattern is used to manage long-running transactions that involve multiple microservices. It ensures that all services involved in a transaction are completed successfully or rolled back in case of failures.
6. 📚 CQRS: This pattern separates the read and writes operations of a system. It uses separate models for reads and writes, which allows for the optimization and scalability of each. This pattern is particularly useful for systems with high read-and-write workloads.
7. 💾 Database per Service: This pattern involves using a separate database for each microservice. This ensures that each microservice has its own data store, which can be optimized for its specific needs. It also helps to prevent coupling between services.
8. 🕺 Saga Choreography: This pattern is similar to the Saga pattern, but instead of having a central orchestrator, each microservice involved in the transaction communicates directly with other services to coordinate the transaction.
9. 🕸️ Service Mesh: This pattern provides a dedicated infrastructure layer for managing communication between microservices. It adds features such as load balancing, service discovery, and security to the network layer, which can be used by any microservice in the system.
10. 🧳 Sidecar: This pattern involves deploying a separate process alongside a microservice, which handles certain tasks such as service discovery, load balancing, or communication with other services. This allows the microservice to focus on its core functionality, while the sidecar handles cross-cutting concerns.
👨💻 Join Amigoscode today for premium programming courses - bit.ly/40ujtvS
ps: credits to the respective owner(s).
#programming#coding#webdevelopment#python#javascript#microservices#java#learntocode#beginnerprogramming#techindustry#opensource#developers
10 AI websites you can't live without:
1. Krisp.ai → AI noise cancellation
2. Stunning.so → Build websites with AI
3. Heyfriday.ai → Easy writing as Friday
4. Stockimg.ai → Design with AI
5. GPTgo.ai → Google search + ChatGPT
6. Cookup.ai → Discover AI apps for every usecase
7. Powermodeai.com → Slides in minutes with AI
8. Spoke.ai → Summarize Slack messages
9. tldv.io → Automatic meeting notes
10. Synthesia.io → Text to video
Full Stack Developer is One of the Highly In Demand and Top Paying Jobs in Tech.
Here's a complete roadmap to be a excellent Full Stack JavaScript Developer (with youtube videos):
A Thread 🧵
¿Puede haber responsabilidad civil por acoso sexual? ¿Un profesor universitario debe indemnizar los perjuicios sufridos por una estudiante a la que acosó? ¿La universidad es solidariamente responsable? Recientemente el Tribunal Superior de Pasto resolvió estas preguntas.
ChatGPT es sólo una gota en el vasto océano de la IA.
En los últimos 30 días se han lanzado más de 2.000 nuevas herramientas de IA🤖.
Aquí tienes 8 sitios web de IA para copywriting✍que te ahorrarán horas de trabajo:
¡JavaScript ha evolucionado mucho últimamente!
Estos dos operadores marcan la diferencia para trabajar mejor con objetos y simplificar tu código.
?. → Optional chaining: Te permite leer la propiedad de un objeto sin necesidad de validar expresamente si la referencia existe.
?? → Nullish Coalescing: Operador lógico que devuelve el operando de la derecha si el de la izquierda es null o undefined.
Aquí tienes un ejemplo de cómo quedaría: