JS files in #/API Last updated: 08. Feb 2026

.JS file placed in the API folder will run on the server and always return JSON. You can only use them in your #/API folder, where you can write dynamic API functions to make use of in your web apps with AJAX (JSON).

Example #/API/.JS file

Server side JS files are only used in your #/API folder. And are primarily used to write WEB API functions returning JSON.

#/API/GetApartments.js

// Accepts POST or GET, reading value floor from FORM or QueryString into parameter "floor"
export default (floor) => {
    /* Get list of files in the apartments folder and filter by property */
    let files = docly.listFiles("#/Apartments", { filter : { "floor" : floor }});
    
    /* Simply return the result and it will be converted to JSON, so the front end
    ** can use the data to generate a dynamic list */
    return files;
}