Getting Server Code

Check the following execution sample to see how to fetch your server code.

node bin/kii-servercode.js get \
  --code-version gulsdf6ful8jvf8uq6fe7vjy6 \
  --site jp \
  --app-id <your_app_id> \
  --app-key <your_app_key> \
  --client-id <your_client_id> \
  --client-secret <your_client_secret> \
  --output-file <output-file>

Here are the options you need to set:

  • --code-version: The version of the server code you want to fetch.
  • --site: The server location (jp).
  • --app-id: The AppID.
  • --app-key: An arbitrary value.
  • --client-id: The ClientID.
  • --client-secret: The ClientSecret.
  • --token: (optional) The app admin token. Can be used instead of client-id and client-secret.
  • --output-file: (optional) The output file (e.g /tmp/mycode.js).
  • --http-proxy: (optional) Specify http proxy, in case client is running behind a firewall or cannot access directly to Kii Cloud API. Eg: https://my.proxy:8080

Make sure to set the values you've got on the developer portal for --site, --app-id, --app-key, --client-id and -- client-secret (See Parameters for executing the commands for more information). You can optionally specify the app admin token with --token instead of specifying the ClientID and ClientSecret (See Admin Features to learn how to get the app admin token).

Kii Cloud will return the server code like this:

17 Jun 17:02:30 - Downloading code version gulsdf6ful8jvf8uq6fe7vjy6...
17 Jun 17:02:32 - Downloaded content:
function demo(params, context) {
  return {
    name: 'Paco',
    age: 45,
    gender: 'M'