starting with OpenAPI documentation
Signed-off-by: Peter Siegmund <developer@mars3142.org>
This commit is contained in:
@@ -0,0 +1,24 @@
|
||||
package dev.mars3142.fhq.timezone_service.config;
|
||||
|
||||
import io.swagger.v3.oas.models.OpenAPI;
|
||||
import io.swagger.v3.oas.models.info.Info;
|
||||
import io.swagger.v3.oas.models.servers.Server;
|
||||
import java.util.List;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
|
||||
@Configuration
|
||||
public class OpenAPIConfig {
|
||||
|
||||
@Bean
|
||||
public OpenAPI timeZoneOpenAPI() {
|
||||
return new OpenAPI()
|
||||
.info(new Info().title("TimeZone API").version("1.0"))
|
||||
.servers(
|
||||
List.of(
|
||||
new Server().url("https://api.firmware-hq.dev/v1/timezone"),
|
||||
new Server().url("http://localhost:8090")
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
@@ -0,0 +1,16 @@
|
||||
package dev.mars3142.fhq.timezone_service.config;
|
||||
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.web.servlet.config.annotation.CorsRegistry;
|
||||
import org.springframework.web.servlet.config.annotation.EnableWebMvc;
|
||||
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
|
||||
|
||||
@Configuration
|
||||
@EnableWebMvc
|
||||
public class WebConfig implements WebMvcConfigurer {
|
||||
|
||||
@Override
|
||||
public void addCorsMappings(CorsRegistry registry) {
|
||||
registry.addMapping("/**");
|
||||
}
|
||||
}
|
@@ -1,21 +0,0 @@
|
||||
package dev.mars3142.fhq.timezone_service.root.web.controller;
|
||||
|
||||
import java.net.URI;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
@RestController
|
||||
@RequestMapping("/")
|
||||
public class RootController {
|
||||
|
||||
@GetMapping
|
||||
public ResponseEntity<Void> getRoot() {
|
||||
return ResponseEntity.status(HttpStatus.SEE_OTHER)
|
||||
.location(URI.create("https://firmware-hq.dev"))
|
||||
.build();
|
||||
}
|
||||
|
||||
}
|
@@ -1,5 +1,5 @@
|
||||
server:
|
||||
port: 8085
|
||||
port: 0
|
||||
|
||||
eureka:
|
||||
client:
|
||||
|
@@ -24,3 +24,6 @@ eureka:
|
||||
defaultZone: http://eureka-service.web:8761/eureka
|
||||
instance:
|
||||
instanceId: ${spring.application.name}:${spring.application.instance_id:${random.value}}
|
||||
springdoc:
|
||||
swagger-ui:
|
||||
path: /swagger-ui.html
|
||||
|
Reference in New Issue
Block a user