The source code that goes along with the article published at
Dart CSS
Latest commit df35cc5 Feb 3, 2015 @chrisbu Merge pull request #9 from sethladd/patch-1
Fix CORS header
Failed to load latest commit information.
json_client Updated code to work with r18115 Feb 8, 2013
simpleserver Fix CORS header Jan 16, 2015 Updated readme Feb 1, 2013


The source code that goes along with the article published at

There are two separate projects in this repo. simpleserver and json_client.

simpleserver is a simple HTTP server that either serves up the data.json file in response to GET requests, or overwrites the content in the file in response to POST requests. The url path is ignored.
simpleserver adds proper CORS headers, so that it can be used with client code served from a different url.
This means that the server can serve data to client-side apps launched from the Dart Editor without access-control-allow-origin issues.

To execute, either run:

dart simpleserver.dart

Load the project into the Dart Editor, and click "Run"

This starts the server listening on http://localhost:8080

json_client contains example code used in the JSON Web Services article.

When the Load button is clicked, it GETs JSON data from the simpleserver and displays it on the client.

The Load structured data button loads the JSON and uses JsonObject to convert the json data into a class-like structure.

Finally, the Save button edits a field and POSTs the data back to the server.