source: src/main/java/com/example/skychasemk/model/WebConfig.java@ fda671c

Last change on this file since fda671c was fda671c, checked in by ste08 <sjovanoska@…>, 3 months ago

Wishlist working, need to fix the Book on Wishlist

  • Property mode set to 100644
File size: 2.0 KB
Line 
1package com.example.skychasemk.model;
2
3import org.springframework.context.annotation.Bean;
4import org.springframework.context.annotation.Configuration;
5import org.springframework.web.servlet.config.annotation.CorsRegistry;
6import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry;
7import org.springframework.web.servlet.config.annotation.ViewControllerRegistry;
8import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
9
10@Configuration
11public 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");
36 registry.addViewController("/wishlists").setViewName("forward:/Wishlist.html");
37 registry.addViewController("/signup").setViewName("forward:/UserSignup.html");
38 registry.addViewController("/views").setViewName("forward:/ViewReport.html");
39 }
40
41}
Note: See TracBrowser for help on using the repository browser.