Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Newer
Older
100644 93 lines (68 sloc) 2.425 kb
8e1407a6 » taylorleese
2012-04-12 updated readme
1 ## StackMob Custom Code Example Projects
7d74815b » taylorleese
2012-04-12 Java/Maven, Scala/Maven, and Scala/sbt example hello world projects
2
f0c6eae2 » ericktai
2012-04-12 Update README.md
3 This example project is a simple Hello World. This adds a server-side method called "hello_world" which can be called from your client iOS, Android, Java Client or JS SDKs:
0c0be3ef » ericktai
2012-04-12 Adding an intro to this README and also adding instructions on how to…
4
4cb42cc4 » arschles
2012-09-05 remove mob1 designation from URL
5 http://api.stackmob.com/hello_world
0c0be3ef » ericktai
2012-04-12 Adding an intro to this README and also adding instructions on how to…
6
7 Custom code allows you to even define the returned JSON. In this case, our simple Hello World example will return:
8
9 { "msg": "Hello, world!" }
10
11 You can call your server-side custom code from your SDK. The request will be sent from the client, StackMob will route the call to the appropriate code and execute the code you've written, then StackMob will return the JSON you've defined.
12
13 <span class="tab callcc" title="iOS SDK"/>
8f5167e0 » ericktai
2012-04-12 adding iOS/Android examples
14 **iOS SDK**
15
16 ```objc
17 [[StackMob stackmob] get:@"hello_world" withCallback:^(BOOL success, id result) {
18 if (success) {
19 // result is the JSON as an NSDictionary of "msg" vs. "Hello, world!"
20 } else {
21 }
22 }];
23
24 ```
0c0be3ef » ericktai
2012-04-12 Adding an intro to this README and also adding instructions on how to…
25 <span class="tab"/>
26
27 <span class="tab callcc" title="Android SDK"/>
8f5167e0 » ericktai
2012-04-12 adding iOS/Android examples
28 **Android SDK**
29
30 ```java
31 StackMobCommon.getStackMobInstance().get("hello_world", new StackMobCallback() {
32 @Override public void success(String responseBody) {
33 //responseBody is "{ \"msg\": \"Hello, world!\" }"
34 }
35 @Override public void failure(StackMobException e) {
36 }
37 });
38 ```
0c0be3ef » ericktai
2012-04-12 Adding an intro to this README and also adding instructions on how to…
39 <span class="tab"/>
40
41 <span class="tab callcc" title="JS SDK"/>
42 **JS SDK**
43
44 ```javascript
45 <script type="text/javascript">
46 StackMob.customcode('hello_world', {}, {
47 success: function(jsonResult) {
a274b477 » ericktai
2012-04-12 Update README.md
48 //jsonResult is the JSON object: { "msg": "Hello, world!" }
0c0be3ef » ericktai
2012-04-12 Adding an intro to this README and also adding instructions on how to…
49 },
50
51 error: function(failure) {
52 //doh!
53 }
54 });
55 </script>
56 ```
57 <span class="tab"/>
58
8e1407a6 » taylorleese
2012-04-12 updated readme
59 ### Java (Maven)
7d74815b » taylorleese
2012-04-12 Java/Maven, Scala/Maven, and Scala/sbt example hello world projects
60
0c0be3ef » ericktai
2012-04-12 Adding an intro to this README and also adding instructions on how to…
61 Building:
266f6d86 » taylorleese
2012-04-12 updated readme
62
63 1. cd java
64 2. mvn clean package
65 3. JAR is located in java/target
9fa11fef » taylorleese
2012-04-12 updated readme
66 4. [Upload JAR to StackMob](https://www.stackmob.com/platform/api/customcode/upload)
7d74815b » taylorleese
2012-04-12 Java/Maven, Scala/Maven, and Scala/sbt example hello world projects
67
8e1407a6 » taylorleese
2012-04-12 updated readme
68 ### Scala (Maven)
7d74815b » taylorleese
2012-04-12 Java/Maven, Scala/Maven, and Scala/sbt example hello world projects
69
70 Building:
266f6d86 » taylorleese
2012-04-12 updated readme
71
72 1. cd scala-maven
73 2. mvn clean package
74 3. JAR is located in scala/target
9fa11fef » taylorleese
2012-04-12 updated readme
75 4. [Upload JAR to StackMob](https://www.stackmob.com/platform/api/customcode/upload)
7d74815b » taylorleese
2012-04-12 Java/Maven, Scala/Maven, and Scala/sbt example hello world projects
76
8e1407a6 » taylorleese
2012-04-12 updated readme
77 ### Scala (sbt)
7d74815b » taylorleese
2012-04-12 Java/Maven, Scala/Maven, and Scala/sbt example hello world projects
78
79 Building:
266f6d86 » taylorleese
2012-04-12 updated readme
80
81 1. cd scala-sbt
82 2. sbt clean package
83 3. JAR is located in scala/target/scala-2.9.1
9fa11fef » taylorleese
2012-04-12 updated readme
84 4. [Upload JAR to StackMob](https://www.stackmob.com/platform/api/customcode/upload)
7d74815b » taylorleese
2012-04-12 Java/Maven, Scala/Maven, and Scala/sbt example hello world projects
85
8e1407a6 » taylorleese
2012-04-12 updated readme
86 ### Clojure (Maven)
7d74815b » taylorleese
2012-04-12 Java/Maven, Scala/Maven, and Scala/sbt example hello world projects
87
09b94b14 » taylorleese
2012-04-12 Add Clojure/Maven example
88 Building:
89
90 1. cd clojure
91 2. mvn clean package
92 3. JAR is located in clojure/target
9fa11fef » taylorleese
2012-04-12 updated readme
93 4. [Upload JAR to StackMob](https://www.stackmob.com/platform/api/customcode/upload)
Something went wrong with that request. Please try again.