Test Function
Input (JSON)
Output
Click "Execute" to run your function...
Function Settings
No function selected
GET/POST/PUT/DELETE /fn/{function-name}
./functions/
{ query, params, body, method, headers }
30 seconds
API Usage Examples
๐ป cURL Examples
Command-line HTTP requests
GET Request
# Simple GET with query parameters
curl "http://localhost:3000/fn/hello?name=World&limit=10"
POST Request
# POST with JSON body
curl -X POST http://localhost:3000/fn/hello \
-H "Content-Type: application/json" \
-d '{"message": "Hello API!", "user": "john"}'
With Authentication
# POST with Bearer token
curl -X POST http://localhost:3000/fn/hello \
-H "Authorization: Bearer your-token-here" \
-H "Content-Type: application/json" \
-d '{"action": "authenticate"}'
๐ข Node.js Examples
Server-side JavaScript
Using fetch() (Node 18+)
const response = await fetch('http://localhost:3000/fn/hello', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
'Authorization': 'Bearer your-token-here'
},
body: JSON.stringify({
message: 'Hello from Node.js!',
timestamp: new Date().toISOString()
})
});
const result = await response.json();
console.log('Function result:', result);
Using axios
const axios = require('axios');
try {
const response = await axios.post('http://localhost:3000/fn/hello', {
message: 'Hello API!',
data: { key: 'value' }
}, {
headers: {
'Authorization': 'Bearer your-token-here'
}
});
console.log('Success:', response.data);
} catch (error) {
console.error('Error:', error.response?.data || error.message);
}
๐ Python Examples
Using requests library
GET Request
import requests
# GET with query parameters
response = requests.get(
'http://localhost:3000/fn/hello',
params={'name': 'World', 'limit': 10}
)
if response.status_code == 200:
result = response.json()
print('Success:', result)
else:
print('Error:', response.status_code, response.text)
POST Request
import requests
# POST with JSON data
response = requests.post(
'http://localhost:3000/fn/hello',
json={
'message': 'Hello from Python!',
'user': 'python-client'
},
headers={'Authorization': 'Bearer your-token-here'}
)
result = response.json()
print('Function result:', result)
๐ JavaScript (Browser)
Client-side web requests
Modern fetch() API
async function callFunction() {
try {
const response = await fetch('/fn/hello', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
'Authorization': 'Bearer your-token-here'
},
body: JSON.stringify({
message: 'Hello from browser!',
userAgent: navigator.userAgent
})
});
if (!response.ok) {
throw new Error(`HTTP error! status: ${response.status}`);
}
const result = await response.json();
console.log('Function result:', result);
return result;
} catch (error) {
console.error('Error calling function:', error);
throw error;
}
}
// Call the function
callFunction();
๐ก Pro Tips
HTTP Methods:
GET, POST, PUT, DELETE supported
Query Parameters:
?name=value&limit=10
Headers:
Passed through (useful for auth)
Response Types:
Return strings for text, objects for JSON
Timeout:
30 second limit for API calls
Input Object:
{ query, params, body, method, headers }
๐ค AI Agent
๐ค
Hello! I'm your AI assistant. I can help you with:
- Writing and optimizing function code
- Debugging issues
- API integration examples
- Best practices and suggestions
Just now
๐ฆ NPM Packages
๐ How to Use Packages
Simply use require() or import in your function code. Packages will be automatically detected and installed when you save the function.
Example Usage
// Using popular packages
const axios = require('axios');
const moment = require('moment');
const _ = require('lodash');
// Your function code
const response = await axios.get('https://api.example.com');
const formatted = moment().format('YYYY-MM-DD');
const filtered = _.filter(data, item => item.active);
๐ Current Function Packages
No packages detected in current function
๐ Installed Packages
Loading packages...