Files
twenty/packages/twenty-server/src/engine/utils/render-apollo-playground.util.ts
Weiko 2c09096edd Refactor backend folder structure (#4505)
* Refactor backend folder structure

Co-authored-by: Charles Bochet <charles@twenty.com>

* fix tests

* fix

* move yoga hooks

---------

Co-authored-by: Charles Bochet <charles@twenty.com>
2024-03-15 18:37:09 +01:00

26 lines
940 B
TypeScript

interface ApolloPlaygroundOptions {
path?: string;
}
export const renderApolloPlayground = ({
path = 'graphql',
}: ApolloPlaygroundOptions = {}) => {
return `
<!DOCTYPE html>
<html lang="en">
<body style="margin: 0; overflow-x: hidden; overflow-y: hidden">
<div id="sandbox" style="height:100vh; width:100vw;"></div>
<script src="https://embeddable-sandbox.cdn.apollographql.com/_latest/embeddable-sandbox.umd.production.min.js"></script>
<script>
new window.EmbeddedSandbox({
target: "#sandbox",
// Pass through your server href if you are embedding on an endpoint.
// Otherwise, you can pass whatever endpoint you want Sandbox to start up with here.
initialEndpoint: "http://localhost:3000/${path}",
});
// advanced options: https://www.apollographql.com/docs/studio/explorer/sandbox#embedding-sandbox
</script>
</body>
</html>`;
};