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

graphql.kickstart.voyager.boot.ReactiveVoyagerController Maven / Gradle / Ivy

package graphql.kickstart.voyager.boot;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.MediaType;
import org.springframework.http.ResponseEntity;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;

import java.io.IOException;

/**
 * @author Max David Günther
 */
@Controller
public class ReactiveVoyagerController {
    @Autowired
    private VoyagerIndexHtmlTemplate indexTemplate;

    @GetMapping(path = "${voyager.mapping:/voyager}")
    public ResponseEntity voyager() throws IOException {
        // no context path in spring-webflux
        String indexHtmlContent = indexTemplate.fillIndexTemplate("");
        return ResponseEntity.ok()
                .contentType(MediaType.valueOf("text/html; charset=UTF-8"))
                .body(indexHtmlContent);
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy