Добавление первых HTML файлов.
This commit is contained in:
parent
b4e48f5c5e
commit
9560588d41
@ -6,7 +6,9 @@ import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
|
||||
|
||||
//отключение Cors фильтра - не позволяет организовавыть взаимодействие с разных доменов
|
||||
@Configuration
|
||||
class WebConfiguration implements WebMvcConfigurer {
|
||||
public class WebConfiguration implements WebMvcConfigurer {
|
||||
public static final String REST_API = "/api";
|
||||
|
||||
@Override
|
||||
public void addCorsMappings(CorsRegistry registry) {
|
||||
registry.addMapping("/**").allowedMethods("*");
|
||||
|
@ -1,6 +1,7 @@
|
||||
package premium_store.controller.controller;
|
||||
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import premium_store.WebConfiguration;
|
||||
import premium_store.controller.DTO.ClientDTO;
|
||||
import premium_store.service.GameClientService;
|
||||
import premium_store.service.TankService;
|
||||
@ -8,7 +9,7 @@ import premium_store.service.TankService;
|
||||
import java.util.List;
|
||||
|
||||
@RestController
|
||||
@RequestMapping("/client")
|
||||
@RequestMapping(WebConfiguration.REST_API + "/client")
|
||||
public class GameClientController {
|
||||
private final GameClientService gameClientService;
|
||||
private final TankService tankService;
|
||||
|
@ -1,6 +1,7 @@
|
||||
package premium_store.controller.controller;
|
||||
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import premium_store.WebConfiguration;
|
||||
import premium_store.controller.DTO.FullNationDTO;
|
||||
import premium_store.service.NationService;
|
||||
import premium_store.service.TankService;
|
||||
@ -12,7 +13,7 @@ import java.util.List;
|
||||
//так же здесь прописываем вызовы методов CRUD в привязке к URL
|
||||
@RestController
|
||||
@CrossOrigin
|
||||
@RequestMapping("/nation")
|
||||
@RequestMapping(WebConfiguration.REST_API + "/nation")
|
||||
public class NationController {
|
||||
private final NationService nationService;
|
||||
private final TankService tankService;
|
||||
|
@ -1,6 +1,7 @@
|
||||
package premium_store.controller.controller;
|
||||
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import premium_store.WebConfiguration;
|
||||
import premium_store.controller.DTO.TankDTO;
|
||||
import premium_store.service.NationService;
|
||||
import premium_store.service.TankLevelService;
|
||||
@ -10,7 +11,7 @@ import java.util.List;
|
||||
|
||||
@RestController
|
||||
@CrossOrigin
|
||||
@RequestMapping("/tank")
|
||||
@RequestMapping(WebConfiguration.REST_API + "/tank")
|
||||
public class TankController {
|
||||
private final TankService tankService;
|
||||
private final TankLevelService tankLevelService;
|
||||
|
@ -1,6 +1,7 @@
|
||||
package premium_store.controller.controller;
|
||||
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import premium_store.WebConfiguration;
|
||||
import premium_store.controller.DTO.LevelDTO;
|
||||
import premium_store.service.TankLevelService;
|
||||
|
||||
@ -10,7 +11,7 @@ import java.util.List;
|
||||
//здесь происходит внедрение зависимости нашего сервиса
|
||||
//так же здесь прописываем вызовы методов CRUD в привязке к URL
|
||||
@RestController
|
||||
@RequestMapping("/level")
|
||||
@RequestMapping(WebConfiguration.REST_API + "/level")
|
||||
public class TankLevelController {
|
||||
private final TankLevelService tankLevelService;
|
||||
|
||||
|
@ -6,6 +6,7 @@ import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.web.bind.MethodArgumentNotValidException;
|
||||
import org.springframework.web.bind.annotation.ControllerAdvice;
|
||||
import org.springframework.web.bind.annotation.ExceptionHandler;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import premium_store.service.exception.ClientNotFoundException;
|
||||
import premium_store.service.exception.LevelNotFoundException;
|
||||
import premium_store.service.exception.NationNotFoundException;
|
||||
@ -15,7 +16,7 @@ import premium_store.util.validation.ValidationException;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
//контроллер для обработки разнообразных ошибок при работе с запросами к БД
|
||||
@ControllerAdvice
|
||||
@ControllerAdvice(annotations = RestController.class)
|
||||
public class AdviceController {
|
||||
//метод handleException будет вызываться при возникновении исключений типа LevelNotFoundException и т. д.
|
||||
@ExceptionHandler({
|
||||
|
@ -0,0 +1,10 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<title>Title</title>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
</body>
|
||||
</html>
|
@ -0,0 +1,51 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="ru"
|
||||
xmlns:th="http://www.thymeleaf.org"
|
||||
xmlns:layout="http://www.ultraq.net.nz/thymeleaf/layout">
|
||||
<head>
|
||||
<meta charset="UTF-8"/>
|
||||
<title>Премиум магазин</title>
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1"/>
|
||||
<link rel="icon" href="/favicon.svg">
|
||||
<script type="text/javascript" src="/webjars/bootstrap/5.1.3/js/bootstrap.bundle.min.js"></script>
|
||||
<link rel="stylesheet" href="/webjars/bootstrap/5.1.3/css/bootstrap.min.css"/>
|
||||
<link rel="stylesheet" href="/webjars/font-awesome/6.1.0/css/all.min.css"/>
|
||||
<link rel="stylesheet" href="/css/style.css"/>
|
||||
</head>
|
||||
<body>
|
||||
<nav class="navbar navbar-expand-lg navbar-light bg-light">
|
||||
<div class="container-fluid">
|
||||
<a class="navbar-brand" href="/">
|
||||
<i class="fa-solid fa-font-awesome"></i>
|
||||
Премиум магазин
|
||||
</a>
|
||||
<button class="navbar-toggler" type="button"
|
||||
data-bs-toggle="collapse" data-bs-target="#navbarNav"
|
||||
aria-controls="navbarNav" aria-expanded="false" aria-label="Toggle navigation">
|
||||
<span class="navbar-toggler-icon"></span>
|
||||
</button>
|
||||
<div class="collapse navbar-collapse" id="navbarNav">
|
||||
<ul class="navbar-nav" th:with="activeLink=${#request.requestURI}">
|
||||
<a class="nav-link" href="/levels"
|
||||
th:classappend="${#strings.equals(activeLink, '/levels')} ? 'active' : ''">Обзор уровней
|
||||
</a>
|
||||
<a class="nav-link" href="/tanks"
|
||||
th:classappend="${#strings.equals(activeLink, '/tanks')} ? 'active' : ''">Обзор танков
|
||||
</a>
|
||||
<a class="nav-link" href="/nations"
|
||||
th:classappend="${#strings.equals(activeLink, '/nations')} ? 'active' : ''">Обзор наций
|
||||
</a>
|
||||
<a class="nav-link" href="/clients"
|
||||
th:classappend="${#strings.equals(activeLink, '/clients')} ? 'active' : ''">Обзор клиентов
|
||||
</a>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
</nav>
|
||||
<div class="container-fluid">
|
||||
<div class="container container-padding" layout:fragment="content"></div>
|
||||
</div>
|
||||
</body>
|
||||
<th:block layout:fragment="scripts">
|
||||
</th:block>
|
||||
</html>
|
@ -0,0 +1,10 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<title>Title</title>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
</body>
|
||||
</html>
|
@ -0,0 +1,10 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<title>Title</title>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
</body>
|
||||
</html>
|
@ -0,0 +1,10 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<title>Title</title>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
</body>
|
||||
</html>
|
Loading…
Reference in New Issue
Block a user