I have been following these instructions and have gotten pretty far - I can get makecode to write to my server. The next bit that’s a little bit fuzzy is loading the URL back - it looks like I need to serve HTML but I am not sure what to serve? (Edit - see diagram in comments for a better picture)
Saving working so far…
- Set shareUrl, embedUrl in pxtarget.json to my own URL
- Share button pressed, successfully posts to myurl.com/api/scripts with a JSON in the body including the all the blocks used.
- I return a short url, it appears in makecode’s url share box
Need help with loading a saved project
- Share URL is now loaded, I need to return some bit of makecode HTML back
I found an old bug (2018) which mentioned next steps
- The editor gives the user the share URL, which will be something like https://www.myTarget.com/_iKX2mKTpMLjL, and the embed URL will be something like https://www.myTarget.com/#pub:_iKX2mKTpMLjL
- Now, when the user tries to navigate to https://www.myTarget.com/_iKX2mKTpMLjL, it is up to your server to deal with the request and return the appropriate project in the embed view
What I’m stuck on:
“it is up to your server to deal with the request and return the appropriate project in the embed view”
- I am not sure which html out of all the built stuff to return? I assume the embed views are all already there. I found run.html, but I wasn’t sure if that’s the one.
- Also I’m not sure how to load the JSON into the embed view.
Any thoughts on this would be most helpful.