Permalink
Browse files

Example updates

  • Loading branch information...
1 parent 53d697e commit a6e676095f383102054ce4bbf9e6ef5ceb9a7e99 @eee-c eee-c committed Feb 1, 2012
Showing with 11 additions and 3 deletions.
  1. +8 −0 examples/comix/app.js
  2. +1 −1 examples/comix/public/scripts/comic_put.dart
  3. +2 −2 examples/comix/views/index.jade
@@ -34,7 +34,15 @@ app.get('/', function(req, res){
res.render('index', { title: 'Comix' });
});
+app.post('/comics', function(req, res) {
+ var graphic_novel = req.body;
+ graphic_novel['id'] = dirtyUuid();
+ db.set(graphic_novel['id'], graphic_novel);
+
+ res.statusCode = 201;
+ res.send(JSON.stringify(graphic_novel));
+});
app.listen(3000);
@@ -22,7 +22,7 @@ main() {
print(json);
var req = new XMLHttpRequest();
- req.open('post', '/comics', true);
+ req.open('post', '/comics', false);
req.setRequestHeader('Content-type', 'application/json');
req.send(json);
print(req.responseText);
@@ -1,5 +1,3 @@
-script(src="scripts/comic_put.dart", type="application/dart")
-
h1= title
p Welcome to #{title}
@@ -30,3 +28,5 @@ form(action="comics", id="new-comic-form")
p
input(type="submit", value="Bazinga!")
+
+script(src="scripts/comic_put.dart.js", type="application/javascript")

0 comments on commit a6e6760

Please sign in to comment.