/**
* Routes file
*
* The routes file is used for defining the HTTP routes.
* Routes are loaded automatically from "app/controllers".
*/
import fs from "node:fs"
import path from "node:path"
const CONTROLLERS_DIRECTORY_URL = new URL(
"../app/controllers/",
import.meta.url,
)
const controllers = (
await fs.promises.readdir(CONTROLLERS_DIRECTORY_URL, {
recursive: true,
withFileTypes: true,
})
).filter((item) => {
return item.isFile() && !item.name.includes(".test.")
await Promise.all(
controllers.map(async (controller) => {
const controllerPath = path.join(controller.parentPath, controller.name)
await import(controllerPath)
}),