DEV Community

Cover image for Introducing Serverless Functions
Deniz for Altogic

Posted on

Introducing Serverless Functions

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.

Introducing serverless (full-code) functions | Altogic - Backend as a service platform

We are excited to announce the release of serverless (full-code) functions. With full-code functions, you write simple, single-purpose functions (e.g., custom code) that are attached to events emitted from your backend application.

favicon altogic.com

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.

https://cdn.circle.so/yozuebq0h86b93leu1gttz5j862h

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.

https://cdn.circle.so/8ulqfoqiyzqfbret2q2lcgw51xyp

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.

https://cdn.circle.so/go6uirw2oy141kiau4f7vhdqvj4g

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.

https://cdn.circle.so/f8vlw68rinfntybhcyprlgq51gwq

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.

https://cdn.circle.so/x6mkne19ybl2q2ucz0gf9gau590f

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.

https://cdn.circle.so/pu9ohbe99hfohlqctpqs33z7pgf8

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.

https://cdn.circle.so/7nrf4br3mcx58rbkyyx808epmxn2

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.

https://cdn.circle.so/jo4dpnofzyp7k295n7rgdfa66vq6

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.

Oldest comments (0)