Serverless handler on Nodejs
Hi. I see there is official SDK for serverless handler, but for Python. I don't see any API for handler in js-sdk.
import runpod
def handler(job):
job_input = job["input"] # request parameters sent to RunPod are exposed via this
# Your code here.
return "your-job-results"
runpod.serverless.start({"handler": handler})import requests
import json
def handler(job):
res = requests.post("http://localhost:3000", json=job["input"])
return res.json()import subprocess
import json
def handler(job):
result = subprocess.run( # use .Popen() for streaming
["node", "script.js"],
input=json.dumps(job["input"]),
text=True,
capture_output=True
)
return json.loads(result.stdout)