Skip to content

Instantly share code, notes, and snippets.

@noam-honig
Last active December 13, 2021 14:53
Show Gist options
  • Save noam-honig/4621f19e66b3448aff30c0485be985cb to your computer and use it in GitHub Desktop.
Save noam-honig/4621f19e66b3448aff30c0485be985cb to your computer and use it in GitHub Desktop.
dynamically load entities
import glob from 'glob';
import path from 'path';
for (const type of ["entity", "controller"]) {
for (const ext of ["js", "ts"]) {
for (const file of glob.sync(`src/**/*.${type}.${ext}`)) {
require(path.resolve(file))
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment