...
API structure consists of such modules:
...
- impl
- spec
- dto
...
impl module
this module contains project controllers. Here example is an example of api-impl structure:
...
Code Block | ||||||
---|---|---|---|---|---|---|
| ||||||
package com.knubisoft.api.impl; import com.knubisoft.api.dto.GenericApiResponse; import com.knubisoft.api.dto.JwtTokensResponse; import com.knubisoft.api.dto.LoginRequest; import com.knubisoft.api.spec.LoginAPI; import com.knubisoft.service.LoginService; import lombok.RequiredArgsConstructor; import org.springframework.http.ResponseEntity; import org.springframework.web.bind.annotation.RestController; import javax.validation.Valid; @RequiredArgsConstructor @RestController public class LoginAPIImpl implements LoginAPI { private final LoginService loginService; @Override public ResponseEntity<GenericApiResponse<JwtTokensResponse>> login(@Valid final LoginRequest requestBody) { final JwtTokensResponse result = loginService.login(requestBody.getUsername(), requestBody.getPassword()); return ResponseEntity.ok(new GenericApiResponse<>(result)); } } |
...
...
spec module
this module consists of xml description of enpoints, controllers, enums, dto and etc. Also generated API interfaces.
...