Skip to content

How to pass a graphql query and other config to a node hosted altair client via http post #2446

Discussion options

You must be logged in to vote

Actually I have realized that the correct way to do this is using altar-static instead, as below:

import { getDistDirectory, renderAltair, RenderOptions } from "altair-static";

dotenv.config();
const app = express();
app.use(express.json());
app.use(express.static(getDistDirectory()));

app.get("/altair", (request, response) => {
let opts: RenderOptions = {
endpointURL: ${process.env.HOST}/graphql/request,
subscriptionsProtocol: "graphql-sse",
subscriptionsEndpoint: ${process.env.HOST}/graphql/stream,
initialQuery: request.query.param as string,
initialHeaders: {
"Content-Type": "application/json",
},
};
return response.send(renderAltair(opts));
});

However I've noticed that the subscripti…

Replies: 1 comment 3 replies

Comment options

You must be logged in to vote
3 replies
@MurrayFurtado
Comment options

Answer selected by imolorhe
@imolorhe
Comment options

@imolorhe
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants