iafan / goplayspace

Advanced Go Playground frontend written in Go, with syntax highlighting, turtle graphics mode, and more
https://goplay.space
Other
981 stars 63 forks source link

Is it possible to provide some API so you could create a playground by passing in some code? #20

Closed nikitavoloboev closed 6 years ago

nikitavoloboev commented 6 years ago

I want to highlight some code in my text editor and make a link to a playground of it that I can share. Without me going to goplayspace first, pasting in text there, pressing share and then getting the link.

Is this possible to do?

iafan commented 6 years ago

This is the API: https://github.com/iafan/goplayspace/blob/master/server/server.go#L111

You do a POST request with your code selection as a payload, and the response body you get back represents the ID of the snippet that you can use to construct the URL to either Go Play Space or official Go Playground.

nikitavoloboev commented 6 years ago

Thank you. This works.