changed base path of REST api and updated frontend api quering
This commit is contained in:
@@ -1,17 +1,19 @@
|
||||
package whattocook.configs;
|
||||
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.data.rest.core.config.RepositoryRestConfiguration;
|
||||
import org.springframework.data.rest.webmvc.config.RepositoryRestConfigurer;
|
||||
import org.springframework.stereotype.Component;
|
||||
import org.springframework.web.servlet.config.annotation.CorsRegistry;
|
||||
@Component
|
||||
public class RestRepositoryConfigurator implements RepositoryRestConfigurer {
|
||||
import whattocook.models.Item;
|
||||
|
||||
@Configuration
|
||||
class RepositoryConfig implements RepositoryRestConfigurer {
|
||||
|
||||
@Override
|
||||
public void configureRepositoryRestConfiguration(RepositoryRestConfiguration config, CorsRegistry cors) {
|
||||
config.disableDefaultExposure();
|
||||
RepositoryRestConfigurer.super.configureRepositoryRestConfiguration(config, cors);
|
||||
config.exposeIdsFor(Item.class);
|
||||
config.setBasePath("/api/v1");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -5,14 +5,11 @@ import lombok.extern.slf4j.Slf4j;
|
||||
import whattocook.models.Item;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import whattocook.models.Unit;
|
||||
import whattocook.services.ItemService;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Slf4j
|
||||
@RestController()
|
||||
@RequestMapping("/api/v1")
|
||||
public class ItemController {
|
||||
|
||||
@Autowired
|
||||
|
||||
Reference in New Issue
Block a user