UNPKG

dflzm

Version:

x

16 lines (13 loc) 387 B
const fs = require('fs') const path = require('path') module.exports = async (ctx, next, app) => { app.context.sql = {} fs .readdirSync(path.join(__dirname, '../server/model')) .filter(f => f.endsWith('.js')) .forEach(f => { const space = f.split('.')[0] app.context.sql[space] = require(path.join(__dirname, '../server/model/', f)) }) await next() }