The MDN sample server
While MDN provides a built-in live sample system for presenting simple (and even not-so-simple) code samples with the code's output displayed in-context, there are samples that require a server to talk to. For those things, we have the MDN sample server, which solves these and other problems. This article is a guide to the use of the sample server.
Most samples can be presented using our built-in live sample system, but there are exceptions. Here are some reasons an example might need to make use of the sample server:
- A sample requiring persistently running code on the server, such as a WebSocket server may have the server component and possibly also the client side component on the sample server.
- A sample using technologies that don't work in the context of the MDN wiki or could interfere with readers' ability to focus on the content would be an obvious candidate; this might include samples that play sound effects or media or have significant amounts of animation.
- A sample which needs to access resources that cannot be hosted on MDN can be placed on the sample server.
Each API has its own directory, e.g. canvas. To create a new sample, add an appropriately named directory under the API's directory there. For example, if your example shows how to use 'drop a file to upload feature', then you might put your sample in drag-and-drop directory.