Fork this repo and link it to your StackMob account to get started with auto-deploying your Custom Code.
Scala
Switch branches/tags
Nothing to show
Pull request Compare This branch is 5 commits ahead, 34 commits behind milesoc:master.
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
src/main/scala/com/stackmob/example
.gitignore
LICENSE.txt
README.md
pom.xml

README.md

StackMob Custom Code Example Project (Maven-based)

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:

http://api.stackmob.com/hello_world

Custom code allows you to even define the returned JSON. In this case, our simple Hello World example will return:

{ "msg": "Hello, world!" }

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.

**iOS SDK**
[[StackMob stackmob] get:@"hello_world" withCallback:^(BOOL success, id result) {
    if (success) {
        // result is the JSON as an NSDictionary of "msg" vs. "Hello, world!"
    } else {
    }
}];
**Android SDK**
StackMobCommon.getStackMobInstance().get("hello_world", new StackMobCallback() {
    @Override public void success(String responseBody) {
        //responseBody is "{ \"msg\": \"Hello, world!\" }"
    }
    @Override public void failure(StackMobException e) {
    }
});
**JS SDK**
<script type="text/javascript">
  StackMob.customcode('hello_world', {}, {
     success: function(jsonResult) {
       //jsonResult is the JSON object: { "msg": "Hello, world!" }
     },
     
     error: function(failure) {
       //doh!
     }
  });
</script>

Java (Maven)

Building:

  1. mvn clean package
  2. JAR is located in target

Deploying

To deploy your Custom Code, first link your github repo with StackMob by authorizing StackMob here. Then follow the provided instructions to configure the deploy hook on GitHub. After that just 'push' to your 'master' branch and your code will be built and deployed seamlessly to the StackMob platform. Your code is only automatically deployed in the Development environment. You retain control when you want to manually deploy to Production. You can also see a history of your deployments.