UNPKG

datoit

Version:

An open source headless CMS solution to create and manage your own API. It provides a powerful dashboard and features to make your life easier. Databases supported: MongoDB, MySQL, MariaDB, PostgreSQL, SQLite

22 lines (15 loc) 391 B
'use strict'; const fse = require('fs-extra'); const walk = require('./walk'); const loadFunctions = dir => { if (!fse.existsSync(dir)) return {}; return walk(dir, { loader: loadFunction }); }; const loadFunction = file => { try { return require(file); } catch (error) { throw `Could not load function ${file}: ${error.message}`; } }; module.exports = loadFunctions;