You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 2 Next »

Structure

API structure is:








api-impl

this module contains project controllers. Here example is an example of api-impl structure:

Controller example is given below:

LoginAPIImpl
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));
    }
}

api-spec

this module consists of xml description of enpoints, controllers, enums, dto and generated API interfaces

About xml description you can find details here

  • No labels