diff options
Diffstat (limited to 'src/server/api/endpoints.ts')
| -rw-r--r-- | src/server/api/endpoints.ts | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/src/server/api/endpoints.ts b/src/server/api/endpoints.ts index 24b58b873c..4c0baf2242 100644 --- a/src/server/api/endpoints.ts +++ b/src/server/api/endpoints.ts @@ -1,7 +1,13 @@ +import { fileURLToPath } from 'url'; +import { dirname } from 'path'; import { Context } from 'cafy'; import * as path from 'path'; import * as glob from 'glob'; -import { Schema } from '@/misc/schema'; +import { Schema } from '@/misc/schema.js'; + +//const _filename = fileURLToPath(import.meta.url); +const _filename = __filename; +const _dirname = dirname(_filename); export type Param = { validator: Context<any>; @@ -102,7 +108,7 @@ export interface IEndpoint { } const files = glob.sync('**/*.js', { - cwd: path.resolve(__dirname + '/endpoints/') + cwd: path.resolve(_dirname + '/endpoints/') }); const endpoints: IEndpoint[] = files.map(f => { |