Introducing Kii Cloud Server Extension
We are happy to announce a powerful new feature on Kii Cloud that brings custom server code to your app – Kii Server Extension!
What is Kii Server Extension?
With many MBaaS solutions, sometimes having client SDKs alone isn’t enough. Maybe your app needs to process information as it’s coming in from your users? Maybe you want to be able to update how data is stored without rolling out updates to your app? The fact of the matter is, there are sometimes requirements for a “helper” server to supplement your Kii Cloud app.
Rather than have to spin up a helper server, Kii Cloud now offers a server extension – where you can create custom APIs and run code in Kii’s cloud. This further reduces the need to work with any servers, and as with all Kii Cloud services – it’s easy to set up and will automatically scale as your app grows.
How can I use it?
Kii Cloud Server Extension is based on server-side Javascript (node.js to be exact). Along with standard JS methods and functionality, Kii Cloud’s Javascript SDK is a perfect fit for creating robust APIs.
Writing the extension
Writing the extension is just like writing Javascript for your web app, but with a specific structure. In this case, we’re fielding a request for an API called ‘main’ and printing “Hello world!”.
function main(params, context) { return "Hello world!"; }
Deploying the extension
Deployment is very easy, and can be managed using our command-line utility. It might end up looking something like:
$ kii-cmd deploy-file \ --file ../demo.js \ --site us \ --app-id <your_app_id> \ --app-key <your_app_key> \ --client-id <your_client_id> \ --client-secret <your_client_secret>
Utilizing within your app
If you deployed the function `main` created above, you now have a brand new API set up! This URL can be accessed REST-style or easily through the client Kii SDKs. The url might be something like:
https://api.kii.com/api/apps/{APP_ID}/server-code/versions/current/main
Next Steps
This is a great new tool for app developers to create robust and powerful apps without ever bothering with servers. As with all Kii Cloud services, scalability and reliability are standard – giving you peace of mind when developing and deploying your app.
If you’d like to learn more, check out our guides to get a custom API up and running in minutes. If you’d like to try it out, sign up for a free account and get started!
Happy coding 🙂