Refactoring backend (#42)
removing cors fails. refactoring ping as a proposal for rest endpoints locations Reviewed-on: PGL/Clyde#42 Reviewed-by: Maxime <231026@umons.ac.be> Co-authored-by: Anthony Debucquoy <debucquoy.anthony@gmail.com> Co-committed-by: Anthony Debucquoy <debucquoy.anthony@gmail.com>
This commit is contained in:
		@ -4,15 +4,15 @@ import org.springframework.web.bind.annotation.GetMapping;
 | 
			
		||||
import org.springframework.web.bind.annotation.CrossOrigin;
 | 
			
		||||
import org.springframework.web.bind.annotation.RestController;
 | 
			
		||||
 | 
			
		||||
import ovh.herisson.Clyde.Ping;
 | 
			
		||||
import ovh.herisson.Clyde.Responses.PingResponse;
 | 
			
		||||
 | 
			
		||||
@RestController
 | 
			
		||||
@CrossOrigin(origins = "http://localhost:5173")
 | 
			
		||||
public class PingController {
 | 
			
		||||
 | 
			
		||||
	@GetMapping("/ping")
 | 
			
		||||
	public Ping ping(){
 | 
			
		||||
		return new Ping(1, "pong");
 | 
			
		||||
	public PingResponse ping(){
 | 
			
		||||
		return new PingResponse(1, "pong");
 | 
			
		||||
	}
 | 
			
		||||
	
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@ -34,16 +34,4 @@ public class JdbcConfig {
 | 
			
		||||
 | 
			
		||||
		return source;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
	@Bean
 | 
			
		||||
	public WebMvcConfigurer corsConfigurer() {
 | 
			
		||||
		return new WebMvcConfigurer() {
 | 
			
		||||
			@Override
 | 
			
		||||
			public void addCorsMappings(CorsRegistry registry) {
 | 
			
		||||
				registry.addMapping("/greeting-javaconfig").allowedOrigins("*");
 | 
			
		||||
			}
 | 
			
		||||
		};
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@ -1,3 +0,0 @@
 | 
			
		||||
package ovh.herisson.Clyde;
 | 
			
		||||
 | 
			
		||||
public record Ping(int id, String txt){};
 | 
			
		||||
@ -0,0 +1,3 @@
 | 
			
		||||
package ovh.herisson.Clyde.Responses;
 | 
			
		||||
 | 
			
		||||
public record PingResponse(int id, String txt){};
 | 
			
		||||
		Reference in New Issue
	
	Block a user