File structure

Users

./users.json contains single user that can login into admin panel (only used in free version).

[
  {
    "login": "demo",
    "password": "demo",
    "permissions": ["admin"],
    "id": 1,
    "otherData": {
      "test": 1
    }
  }
]

Config

./config.json contains your custom configuration data, you can override those values via enviroment variables

{
  "someToken": "12345",
  "openAiToken": "sk-xxx-1234-8908",
  "mockOpenAiResponse": true
}

Connections

./connections/ folder contains all details needed for connecting with

JS

./js/ contains your custom javascript logic

In order to run any of those files, you need to have query definition

Example

//                           ./js/chat-gpt-call-js
console.log(JSON.stringify({
    request: request,
    user: user,
    config: config,
    params: request.params
}))

./queries/chat-gpt-call-js.json

{
  "type": "javascript",
  "id": "chat-gpt-call-js",
  "file": "chat-gpt-logic.js",
  "public": true,
  "params": [
    {
      "name": "query",
      "required": true
    },
    {
      "name": "sync",
      "required": true,
      "defaultValue": false
    }
  ]
}

Admin Pages

./pages

Each file in ./pages directory will create one admin page

  • ./pages/users.json -> http://localhost:8080/users
  • ./pages/subscriptions.json -> http://localhost:8080/subscriptions
  • ./pages/engeenering.json -> http://localhost:8080/engeenering
  • ./pages/manual-order-handling.json -> http://localhost:8080/manual-order-handling

Queries

./queries directory contain all actions that you can execute in apizilla (via rest server and admin panel)

  • sql select
  • sql select paginated
  • execute delete/update sql queries
  • build custom sql queries in runtime
  • custom js logic
  • send message into queue
  • call external rest api

Example

./queries/chat-gpt-count-usage.json

{
  "type": "sql-select",
  "id": "chat-gpt-count-usage",
  "connection": "db-chat-gpt",
  "query": "SELECT SUM(token) as tokens FROM chat_gpt where created_at > NOW() - interval ':days days'",
  "resultType": "single",
  "params": [
    {
      "name": "days",
      "required": true,
      "defaultValue": 1
    }
  ]
}

Static files

./static/ folder contains all static assets, apizilla will take care of serving those files

Examples

`./static/favicon.ico` -> http://localhost:8080/favicon.ico
`./static/my-image.jpg` -> http://localhost:8080/my-image.jpg

index.html

./static/index.html

index.html is a special one, if file is present, then it’ll be used as - default page, if that file does not exist then you will be redirected into admin panel

Tmp

./tmp directory contain all code generated via ./apizilla.exe generate

Last modified April 16, 2024: content fix (a2d9b96)