@cubi/fileloader
v1.0.0
Published
The common file-loader module for cubi framework
Downloads
5
Readme
FILELOADER
description
auto load files or node`s modules for specify filePath.
install
npm install @cubi/fileloader
use
import { FileLoader } from '@cubi/fileloader';
const fileLoader = new FileLoader(__dirname, __filename, async data => {
const { default as router } = data;
// 注册路由
app.use(router.routes()).use(router.allowedMethods());
});
async fileLoader.load();
OR
import { FileLoader } from '@cubi/fileloader';
const fileLoader = new FileLoader(__dirname, __filename);
async fileLoader.forEach(async (data) => {
const { default as router } = data;
// 注册路由
app.use(router.routes()).use(router.allowedMethods());
});