Last active
December 13, 2021 14:53
-
-
Save noam-honig/4621f19e66b3448aff30c0485be985cb to your computer and use it in GitHub Desktop.
dynamically load entities
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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