Skip to content

Commit

Permalink
set content type for JSON API results
Browse files Browse the repository at this point in the history
  • Loading branch information
Tim Burks committed Jul 6, 2010
1 parent 4cfb479 commit 7efd6ec
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
6 changes: 6 additions & 0 deletions service/numongo/site.nu
Expand Up @@ -10,6 +10,7 @@
(mongo ensureCollection:"stickup.stickups" hasIndex:(dict location:"2d") withOptions:0)

(post "/reset"
(REQUEST setContentType:"application/json")
(mongo dropCollection:"users" inDatabase:"stickup")
(mongo dropCollection:"stickups" inDatabase:"stickup")
((dict status:200 message:"Reset database.") JSONRepresentation))
Expand All @@ -33,6 +34,7 @@
(&td (stickup message:)))))))))

(post "/stickup"
(REQUEST setContentType:"application/json")
(set stickup (REQUEST post))
(set user nil)
(if (stickup user:)
Expand All @@ -56,6 +58,7 @@
JSONRepresentation))))

(post "/stickups"
(REQUEST setContentType:"application/json")
(mongo ensureCollection:"stickup.stickups" hasIndex:(dict location:"2d") withOptions:0)
(set query (dict))
(if (and (set latitude (((REQUEST post) latitude:) floatValue))
Expand All @@ -71,6 +74,7 @@
JSONRepresentation))

(get "/count"
(REQUEST setContentType:"application/json")
(set count (mongo countWithCondition:nil inCollection:"stickups" inDatabase:"stickup"))
((dict status:200 count:count) JSONRepresentation))

Expand All @@ -79,6 +83,7 @@
JSONRepresentation))

(post "/signup"
(REQUEST setContentType:"application/json")
(set info (REQUEST post))
(set user (info user:))
(set password (info password:))
Expand All @@ -94,6 +99,7 @@
JSONRepresentation))

(get "/users"
(REQUEST setContentType:"application/json")
(set users (mongo findArray:nil
inCollection:"stickup.users"
returningFields:(dict password:0)
Expand Down
1 change: 0 additions & 1 deletion service/numongo/stickupd.pid

This file was deleted.

0 comments on commit 7efd6ec

Please sign in to comment.