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

com.networknt.graphql.router.GraphqlEndpointSource Maven / Gradle / Ivy

The newest version!
package com.networknt.graphql.router;

import com.networknt.graphql.common.GraphqlUtil;
import com.networknt.handler.config.EndpointSource;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import java.util.Arrays;

/**
 * Lists standard GraphQl endpoints at /graphql (or as reconfigured in Graphql.config)
 */
public class GraphqlEndpointSource implements EndpointSource {

    private static final Logger log = LoggerFactory.getLogger(GraphqlEndpointSource.class);

    @Override
    public Iterable listEndpoints() {
        String graphqlPath = GraphqlUtil.config.getPath();
        if(log.isInfoEnabled()) log.info("Generating " + graphqlPath + " from graphql.yml");
        return Arrays.asList(
            new Endpoint(graphqlPath, "GET"),
            new Endpoint(graphqlPath, "POST"),
            new Endpoint(graphqlPath, "OPTIONS")
            // The subscriptions websocket endpoint does not need to be listed
        );
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy