[57e58a3] | 1 | package com.example.skychasemk.model;
|
---|
| 2 |
|
---|
| 3 | import org.springframework.context.annotation.Bean;
|
---|
| 4 | import org.springframework.context.annotation.Configuration;
|
---|
| 5 | import org.springframework.web.servlet.config.annotation.CorsRegistry;
|
---|
| 6 | import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry;
|
---|
| 7 | import org.springframework.web.servlet.config.annotation.ViewControllerRegistry;
|
---|
| 8 | import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
|
---|
| 9 |
|
---|
| 10 | @Configuration
|
---|
| 11 | public class WebConfig implements WebMvcConfigurer {
|
---|
| 12 |
|
---|
| 13 | @Override
|
---|
| 14 | public void addCorsMappings(CorsRegistry registry) {
|
---|
| 15 | // Allow cross-origin requests from your frontend
|
---|
| 16 | registry.addMapping("/**")
|
---|
| 17 | .allowedOrigins("http://localhost:8080")
|
---|
| 18 | .allowedMethods("GET", "POST", "PUT", "DELETE")
|
---|
| 19 | .allowedHeaders("*")
|
---|
| 20 | .allowCredentials(true);
|
---|
| 21 | }
|
---|
| 22 | @Override
|
---|
| 23 | public void addResourceHandlers(ResourceHandlerRegistry registry) {
|
---|
| 24 | registry.addResourceHandler("/**")
|
---|
| 25 | .addResourceLocations("classpath:/static/");
|
---|
| 26 | }
|
---|
| 27 | @Override
|
---|
| 28 | public void addViewControllers(ViewControllerRegistry registry) {
|
---|
| 29 | registry.addViewController("/admin").setViewName("forward:/AdminLogin.html");
|
---|
| 30 | registry.addViewController("/flights").setViewName("forward:/FlightSearch.html");
|
---|
| 31 | registry.addViewController("/my-reservations").setViewName("forward:/MyReservations.html");
|
---|
| 32 | registry.addViewController("/reviews").setViewName("forward:/ReviewPage.html");
|
---|
| 33 | registry.addViewController("/support-tickets").setViewName("forward:/SupportTickets.html");
|
---|
| 34 | registry.addViewController("/transaction").setViewName("forward:/TransactionPage.html");
|
---|
| 35 | registry.addViewController("/login").setViewName("forward:/UserLogin.html");
|
---|
[fda671c] | 36 | registry.addViewController("/wishlists").setViewName("forward:/Wishlist.html");
|
---|
[57e58a3] | 37 | registry.addViewController("/signup").setViewName("forward:/UserSignup.html");
|
---|
[62bba0c] | 38 | registry.addViewController("/views").setViewName("forward:/ViewReport.html");
|
---|
[57e58a3] | 39 | }
|
---|
| 40 |
|
---|
| 41 | }
|
---|