Last active
October 29, 2022 14:09
-
-
Save VictorKabata/5b7bab9274183f2d6a9d05e45749d11c to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
... | |
var sandboxHTML = []byte(` | |
<!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:8080/graphql", | |
}); | |
// advanced options: https://www.apollographql.com/docs/studio/explorer/sandbox#embedding-sandbox | |
</script> | |
</body> | |
</html>`) | |
http.Handle("/sandbox", http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { w.Write(sandboxHTML) })) | |
log.Fatal(http.ListenAndServe(":8080", nil)) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment