Introducing Serverless Functions
Deniz
Posted on October 31, 2022
We are excited to announce the release of serverless functions. šš„
With serverless (full-code) functions, you can write simple, single-purpose functions (e.g., custom code) that are attached to events emitted from your Altogic backend application.
Now, you can create both no-code services or full-code functions to handle the backend needs of your apps.
We provide the best of both worlds, the speed to develop functions with no-code, and the flexibility to handle complex requirements with full-code.
It is quite easy to deploy your functions. After installing Altogic CLI, you first need to log in to your Altogic Account.
Your session information will be locally stored so that you do not need to log in again until you log out from your active session.
Once logged in, you can create your full-code function. It will first ask you to select the application you want to create the function for. Following app selection, you need to provide a name to your function and select the runtime environment.
The create function command will create a folder in your current directory using the name of your function and it will also create an altogic.json file to keep the configuration parameters.
You can use your code editor to write the code for your function.
After completing the code of your function, you can easily deploy it to your application environment.
When you run the deploy command, Altogic creates a new image and applies this image to your app's execution environment.
It may take a couple of minutes to build and deploy your function. You can run altogic get builds and altogic get deployments to get the status of your builds and deployments, respectively.
After writing and successfully deploying your function to your execution environment, you need to link your function to an endpoint, message queue, and/or scheduled task. You can use Altogic Designer to configure your endpoint, message queue, and cron job handlers.
You can also test your functions locally. The start command will launch a local HTTP server and provide you the endpoint of the function. The start command has hot-reloading capabilities. It will watch for any changes to your files and restart the HTTP server.
You can use Altogic Tester or any other API testing tool (e.g., Postman) to test your serverless functions. In your function code, you can log messages using console.log method. Upon execution of your deployed function, these log messages are also returned in response body.
We are quite excited to see what you will be building with Altogic serverless functions. If you have questions about Altogic serverless functions or want to share what you have built, please post a message in our community forum or discord channel.
Posted on October 31, 2022
Join Our Newsletter. No Spam, Only the good stuff.
Sign up to receive the latest update from our blog.