diff options
Diffstat (limited to 'src/server/api/endpoints.ts')
| -rw-r--r-- | src/server/api/endpoints.ts | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/src/server/api/endpoints.ts b/src/server/api/endpoints.ts index 24b58b873c..640b14ed6a 100644 --- a/src/server/api/endpoints.ts +++ b/src/server/api/endpoints.ts @@ -1,8 +1,14 @@ +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'; +//const _filename = fileURLToPath(import.meta.url); +const _filename = __filename; +const _dirname = dirname(_filename); + export type Param = { validator: Context<any>; transform?: 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 => { |