All Downloads are FREE. Search and download functionalities are using the official Maven repository.

example.controllers.PetController Maven / Gradle / Ivy

The newest version!
package example.controllers;

import java.util.List;
import java.util.Optional;

import example.domain.NameDTO;
import example.domain.Pet;
import example.repositories.PetRepository;
import io.micronaut.data.model.Pageable;
import io.micronaut.http.annotation.Controller;
import io.micronaut.http.annotation.Get;

@Controller("/pets")
class PetController {

    private final PetRepository petRepository;

    PetController(PetRepository petRepository) {
        this.petRepository = petRepository;
    }

    @Get("/")
    List all(Pageable pageable) {
        return petRepository.list(pageable);
    }

    @Get("/{name}")
    Optional byName(String name) {
        return petRepository.findByName(name);
    }

}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy