Serverless Overview
Serverless technology is a means of adding custom behaviour without having to worry too much about infrastructure, deployment, or maintenance. Serverless functions are single-purpose, programmatic functions that are hosted by cloud computing platforms.
Read More...
- If you were a customer before Nov 10th 2023, you can continue to access the legacy OpenWhisk docs until Dec 31st 2024
- The next sections are related to the modern Hypi Fenrir Serverless platform
@fn directive
Serverless support is provided through a GraphQL directive @fn
.
The @fn directive has the following structure.
directive @fn(
name: String!
version: String!
env: [String!]
) on FIELD_DEFINITION
It is applied to fields in your Hypi app's schema and the Hypi platform will invoke the function named in the directive in order to get the value of the field.
type Query {
myFnName(a: Int, b: String, c: Float, d: Boolean, e: Json, f: MyType): Json @fn(name:"my-fn", version: "v1", env: ["abc"])
}
Here, when myFnName
is used in a query, version v1
of the my-fn
serverless function will be called and the environment variable
abc
will be passed into the function along with all the args to the field.