Learn FISSION with Real Code Examples
Updated Nov 25, 2025
Code Sample Descriptions
1
Simple Fission Function (Go)
# fission/demo/function.yaml
apiVersion: fission.io/v1
kind: Function
metadata:
name: hello-go
namespace: default
spec:
environment:
name: go
runtime: go
code:
inline:
function: |
package main
import (
"fmt"
"net/http"
)
func Handler(w http.ResponseWriter, r *http.Request) {
fmt.Fprintf(w, "Hello, Fission!")
}
routes:
- path: /hello
method: GET
A simple Fission YAML configuration to deploy a Go HTTP function.
2
Python HTTP Function
# fission/demo/python_func.yaml
apiVersion: fission.io/v1
kind: Function
metadata:
name: hello-python
namespace: default
spec:
environment:
name: python
runtime: python3
code:
inline:
function: |
import json
def main(req):
return json.dumps({'message': 'Hello, Fission!'})
routes:
- path: /hello
method: GET
Deploys a Python HTTP function that returns JSON.
3
Node.js Function Example
# fission/demo/node_func.yaml
apiVersion: fission.io/v1
kind: Function
metadata:
name: hello-node
namespace: default
spec:
environment:
name: nodejs
runtime: nodejs14
code:
inline:
function: |
module.exports = async function(context) {
return { status: 200, body: 'Hello from Node.js!' };
}
routes:
- path: /hello
method: GET
A Node.js HTTP function returning a greeting.
4
Go Function with Query Param
# fission/demo/go_query.yaml
apiVersion: fission.io/v1
kind: Function
metadata:
name: greet-go
namespace: default
spec:
environment:
name: go
runtime: go
code:
inline:
function: |
package main
import (
"fmt"
"net/http"
)
func Handler(w http.ResponseWriter, r *http.Request) {
name := r.URL.Query().Get("name")
if name == "" { name = "Guest" }
fmt.Fprintf(w, "Hello, %s!", name)
}
routes:
- path: /greet
method: GET
A Go HTTP function that reads a query parameter and responds.
5
Python Function with POST Body
# fission/demo/python_post.yaml
apiVersion: fission.io/v1
kind: Function
metadata:
name: echo-python
namespace: default
spec:
environment:
name: python
runtime: python3
code:
inline:
function: |
import json
def main(req):
data = json.loads(req.body)
return {'received': data}
routes:
- path: /echo
method: POST
A Python HTTP function that reads JSON from POST body.
6
Node.js Function with Params
# fission/demo/node_query.yaml
apiVersion: fission.io/v1
kind: Function
metadata:
name: greet-node
namespace: default
spec:
environment:
name: nodejs
runtime: nodejs14
code:
inline:
function: |
module.exports = async function(context) {
const name = context.query.name || 'Guest';
return { status: 200, body: `Hello, ${name}!` };
}
routes:
- path: /greet
method: GET
Node.js HTTP function that reads query params.
7
Go JSON Response Function
# fission/demo/go_json.yaml
apiVersion: fission.io/v1
kind: Function
metadata:
name: json-go
namespace: default
spec:
environment:
name: go
runtime: go
code:
inline:
function: |
package main
import (
"encoding/json"
"net/http"
)
type Response struct { Message string `json:"message"` }
func Handler(w http.ResponseWriter, r *http.Request) {
resp := Response{Message: "Hello JSON!"}
json.NewEncoder(w).Encode(resp)
}
routes:
- path: /json
method: GET
A Go HTTP function returning JSON.
8
Python Environment Variables
# fission/demo/python_env.yaml
apiVersion: fission.io/v1
kind: Function
metadata:
name: env-python
namespace: default
spec:
environment:
name: python
runtime: python3
code:
inline:
function: |
import os
def main(req):
return {'env_value': os.getenv('MY_VAR', 'default')}
routes:
- path: /env
method: GET
A Python function using environment variables.
9
Node.js POST JSON Function
# fission/demo/node_post.yaml
apiVersion: fission.io/v1
kind: Function
metadata:
name: echo-node
namespace: default
spec:
environment:
name: nodejs
runtime: nodejs14
code:
inline:
function: |
module.exports = async function(context) {
return { status: 200, body: context.body };
}
routes:
- path: /echo
method: POST
A Node.js HTTP function that echoes JSON POST data.