🥘 Skillet Expression Server

A high-performance mathematical and logical expression evaluation server.

📖 Interactive API Documentation

For a better experience with interactive examples, schemas, and testing capabilities, visit:

🚀 View Interactive API Docs

The interactive documentation includes request/response examples, schema validation, and a "try it out" feature.

Quick Reference - API Endpoints

GET /health

Server health check and statistics

POST /eval

Evaluate expressions via JSON POST request

      {
        "expression": "=2 + 3 * 4",
        "arguments": {"x": 10, "y": 20},
        "output_json": true
      }
      

POST /upload-js

Upload and validate JavaScript functions

⚠️ Requires admin token authentication

      {
        "filename": "myfunction.js",
        "js_code": "// @name: MYFUNCTION\n// @min_args: 1\n// @max_args: 1\n// @example: MYFUNCTION(5) returns 10\nfunction execute(args) { return args[0] * 2; }"
      }
    

GET /list-js

List all JavaScript functions in hooks directory

Returns detailed information about each function including validation status

⚠️ Requires admin token authentication

PUT /update-js

Update an existing JavaScript function

⚠️ Requires admin token authentication

      {
        "filename": "myfunction.js",
        "js_code": "// @name: MYFUNCTION\n// @min_args: 1\n// @max_args: 1\n// @example: MYFUNCTION(10) returns 20\nfunction execute(args) { return args[0] * 2; }"
      }
      

DELETE /delete-js

Delete a JavaScript function file

⚠️ Requires admin token authentication

      {
        "filename": "myfunction.js"
      }
      

POST /reload-hooks

Reload all JavaScript functions from hooks directory

⚠️ Requires admin token authentication

{}

Examples

      # Health check
      curl http://localhost:5074/health

      # Simple evaluation
      curl -X POST http://localhost:5074/eval \
        -H "Content-Type: application/json" \
        -d '{"expression": "=2 + 3 * 4"}'

      # With variables
      curl -X POST http://localhost:5074/eval \
        -H "Content-Type: application/json" \
        -d '{"expression": "=:x + :y", "arguments": {"x": 10, "y": 20}}'

      # JavaScript function management (requires admin token)
      # List all JS functions
      curl -H "Authorization: admin456" http://localhost:5074/list-js

      # Upload a JS function
      curl -X POST http://localhost:5074/upload-js \
        -H "Content-Type: application/json" \
        -H "Authorization: admin456" \
        -d '{"filename": "double.js", "js_code": "// @name: DOUBLE\n// @example: DOUBLE(5) returns 10\nfunction execute(args) { return args[0] * 2; }"}'

      # Update a JS function
      curl -X PUT http://localhost:5074/update-js \
        -H "Content-Type: application/json" \
        -H "Authorization: admin456" \
        -d '{"filename": "double.js", "js_code": "// @name: DOUBLE\n// @example: DOUBLE(5) returns 20\nfunction execute(args) { return args[0] * 4; }"}'

      # Delete a JS function
      curl -X DELETE http://localhost:5074/delete-js \
        -H "Content-Type: application/json" \
        -H "Authorization: admin456" \
        -d '{"filename": "double.js"}'

      # Reload hooks
      curl -X POST http://localhost:5074/reload-hooks \
        -H "Content-Type: application/json" \
        -H "Authorization: admin456" \
        -d '{}'