import path from 'path'; import Database from '@nocobase/database'; import Resourcer from '@nocobase/resourcer'; import getCollection from './actions/getCollection'; import getView from './actions/getView'; import getRoutes from './actions/getRoutes'; import getPageInfo from './actions/getPageInfo'; export default async function (options = {}) { const database: Database = this.database; const resourcer: Resourcer = this.resourcer; database.import({ directory: path.resolve(__dirname, 'collections'), }); resourcer.registerActionHandler('getCollection', getCollection); resourcer.registerActionHandler('getView', getView); resourcer.registerActionHandler('getPageInfo', getPageInfo); resourcer.registerActionHandler('pages:getRoutes', getRoutes); }