`processor` In `fastn`

`ftd` gives a way for its platform, `fastn`, to define some functions known as `processors`. These functions, then, can be used in the `ftd`, and their execution is handled by the platform. At present, `fastn` contains the following processors: - [HTTP Processor](/http/) - [Request Data Processor](/request-data/) - [Get Data Processor](/get-data/) - [SQLite Processor](/package-query/) All processors are defined in a module `fastn/processor` which must be imported to use any of these processors.
⚠️
Static Vs Dynamic
This feature works better with dynamic hosting. If you are using `fastn` in [static site mode](/static/), then how the page looked when `fastn build` was called will be shown to everyone. But if you are using [dynamic mode](/server/) then this page would be regenerated on every page load.

`$processor$`

A processor is used when declaring a variable. The processor is in control of the variable if `$processor$` key is used.
-- import: fastn/processors as pr

-- person list people:
$processor$: pr.package-query
db: db.sqlite

SELECT * FROM user;
Lang:
ftd
As you see `$processor$` key was used when defining the variable called `people`. Once `$processor$` is used, the rest of the section is in determined bu the specific processor used. Like in this case the processor `pr.package-query` expects a key named `db`, which refers to the database file, and the body of the section is the SQL query to execute against the database. A processor must be used on a variable or a list with matching type as the output of the processor. In this case we are using `SELECT * FROM user;` so the columns of the `user` table must match the fields of the record `person`. Extra data will be ignored, but all required data must be passed for processor to work correctly. The details of what the processor returns is documented as part of each processors documentation.

Planned: Custom Processors

`fastn` is planning to use [wasmtime](https://wasmtime.dev) to let anyone write their own custom processors, which will allow much more functionalities.

Support `fastn`!

Enjoying `fastn`? Please consider giving us a star ⭐️ on [GitHub](https://github.com/fastn-stack/fastn) to show your support!
[⭐️](https://github.com/fastn-stack/fastn)

Getting Help

Have a question or need help? Visit our [GitHub Q&A discussion](https://github.com/fastn-stack/fastn/discussions/categories/q-a) to get answers and subscribe to it to stay tuned. Join our [Discord](https://discord.gg/a7eBUeutWD) channel and share your thoughts, suggestion, question etc. Connect with our [community](/community/)!
[💻️](/community/)

Found an issue?

If you find some issue, please visit our [GitHub issues](https://github.com/fastn-stack/fastn/issues) to tell us about it.

Quick links:

- [Install `fastn`](install/) - [Create `fastn` package](create-fastn-package/) - [Expander Crash Course](expander/) - [Syntax Highlighting in Sublime Text](/sublime/)

Join us

We welcome you to join our [Discord](https://discord.gg/a7eBUeutWD) community today. We are trying to create the language for human beings and we do not believe it would be possible without your support. We would love to hear from you.
Copyright © 2023 - [FifthTry.com](https://www.fifthtry.com/)