What's new in GNU Artanis 1.3.0?
We are pleased to announce the release of GNU Artanis 1.3.0, Here is the announcement.
GNU Artanis is a web application framework written in Guile Scheme. It is a simple and efficient tool for building web applications. It is designed to support the development of dynamic websites, web services, and web applications. It is a modern web framework that is easy to use and easy to extend.
What's new?
Async Runner
Artanis 1.3.0 introduces a new async runner, which allows you to run asynchronous tasks without blocking the coroutine server-core. This is useful for tasks that take a long time to complete, such as sending emails, processing learning algorithms, or fetch a remote Web API.
Say, you have to run a slow task when a user visit certain WebAPI from you.
#!/bin/bash # Assuming it's your super deep leaning algorithm sleep 5 echo "ok, we got an excellent result!"
Let's save it as `slow-task.sh` in the current directory. And you can call it in your API design:
(import (artanis runner) (artanis cli)) (get "/test" (lambda (rc) (call-with-runner (lambda () (cli-run* ./slow-task.sh)))))
Then let's run the server and visit the API:
curl localhost:3000/test # ==> ok, we got an excellent result!
Runner based HTTP client
Since Artanis 1.3.0, the client module relies on the async runner to avoid blocking the server core when making HTTP requests. This is useful for interacting with WebAPIs, say, LLM.
(import (artanis client) (srfi srfi-11)) ; for let-values (get "/get/artanis/feed" #:mime 'xml (lambda (rc) (let-values (((req body) (artanis:http-get "https://artanis.dev/rss.xml"))) (:mime rc body))))
The customized config
The customizable config is always start with custom namespace. Say, you add an item in conf/artanis.conf
custom.myitem = a-test-config
And for example you have a controller /test
(import (artanis config)) ; for conf-get (get "/test" (lambda (rc) (conf-get '(custom myitem))))
Support plugin init
This is useful when you want to run init function before the plugin is enabled.
(plugin-enable! name handler init ...)
Please take a look at artanis-mqtt-example for more details.
Feel free to contribute!
Happy hacking!