Package com.mapmyjourney.backend.config
Class CorsConfig
java.lang.Object
com.mapmyjourney.backend.config.CorsConfig
- All Implemented Interfaces:
org.springframework.web.servlet.config.annotation.WebMvcConfigurer
@Configuration
public class CorsConfig
extends Object
implements org.springframework.web.servlet.config.annotation.WebMvcConfigurer
Configuración de CORS (Cross-Origin Resource Sharing)
Permite que el frontend pueda hacer solicitudes al backend
CORS permite solicitudes desde:
- http://localhost:4200 (desarrollo Angular local)
- http://localhost:3000 (desarrollo Node local)
- https://mapmyjourney-4w93.onrender.com (producción)
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidaddCorsMappings(org.springframework.web.servlet.config.annotation.CorsRegistry registry) Configura los parámetros CORS para todas las rutas.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.springframework.web.servlet.config.annotation.WebMvcConfigurer
addArgumentResolvers, addErrorResponseInterceptors, addFormatters, addInterceptors, addResourceHandlers, addReturnValueHandlers, addViewControllers, configureAsyncSupport, configureContentNegotiation, configureDefaultServletHandling, configureHandlerExceptionResolvers, configureMessageConverters, configurePathMatch, configureViewResolvers, extendHandlerExceptionResolvers, extendMessageConverters, getMessageCodesResolver, getValidator
-
Constructor Details
-
CorsConfig
public CorsConfig()
-
-
Method Details
-
addCorsMappings
public void addCorsMappings(org.springframework.web.servlet.config.annotation.CorsRegistry registry) Configura los parámetros CORS para todas las rutas. Permite peticiones GET, POST, PUT, DELETE con credenciales.- Specified by:
addCorsMappingsin interfaceorg.springframework.web.servlet.config.annotation.WebMvcConfigurer
-