-
Notifications
You must be signed in to change notification settings - Fork 11
Description
Eventually, I want to reduce the overhead of sharing a vexml rendering. I propose creating a share server.
- POST /share [body=musicxml,config] returns shareUrl
- GET /share/{shareId} returns { musicxml, config }
- DELETE /share/{shareId} returns void
When the share button is clicked, the share server will normalize and hash the config. If the hash exists in the database, it will return that share URL, otherwise, it will create a new share entry.
When the user visits the share URL, the dev site will search for a workspace entry whose type is share and the share URL matches. If there are no matches, it will shift a workspace entry for it.
The site will fetch the musicXML and config from the share server. If it doesn’t exist, it should display an error with a button for the user to try again.
In terms of infrastructure, I recommend a simple HTTP Koa server in TypeScript, so that it can import the types from site/. The database should be a simple NoSQL database where the keys are hash results and the values are { shareId, musicXML, config } objects. When picking a specific NoSQL database, the keys must be able to accommodate the length of the hash results.
The client is responsible for reconciling shares that have invalid configs. I recommend to coerce invalid config keys to their default value.