File tree Expand file tree Collapse file tree 6 files changed +15
-19
lines changed
Expand file tree Collapse file tree 6 files changed +15
-19
lines changed Original file line number Diff line number Diff line change 11import express , { Request , Response } from 'express'
2+ import path from 'path'
23import { asyncHandler } from '~/lib/async-handler'
34import HttpResponse from '~/lib/http/response'
4- import { __dirname , require } from '~/lib/string'
55import { v1Route } from './v1'
66
77const route = express . Router ( )
8+ const dirname = path . join ( __dirname , '../../../' )
89
910function versioning ( ) {
10- const node_modules = `${ __dirname } /node_modules`
11+ const node_modules = `${ dirname } /node_modules`
1112 const express = require ( `${ node_modules } /express/package.json` ) . version
12- const app = require ( `${ __dirname } /package.json` ) . version
13+ const app = require ( `${ dirname } /package.json` ) . version
1314
1415 return { express : `v${ express } ` , app : `v${ app } ` }
1516}
Original file line number Diff line number Diff line change @@ -16,9 +16,10 @@ import expressWithState from '~/app/middleware/with-state'
1616import { Route } from '~/app/routes/route'
1717import { allowedCors } from '~/lib/constant/allowed-cors'
1818import ErrorResponse from '~/lib/http/errors'
19- import { __dirname } from '~/lib/string'
2019import { httpLogger } from './logger'
2120
21+ const dirname = path . join ( __dirname , '../../' )
22+
2223export class App {
2324 private _app : Application
2425
@@ -32,7 +33,7 @@ export class App {
3233 this . _app . use ( httpLogger )
3334 this . _app . use ( express . json ( { limit : '20mb' , type : 'application/json' } ) )
3435 this . _app . use ( express . urlencoded ( { extended : true } ) )
35- this . _app . use ( express . static ( path . resolve ( `${ __dirname } /public` ) ) )
36+ this . _app . use ( express . static ( path . resolve ( `${ dirname } /public` ) ) )
3637 this . _app . use ( compression ( ) )
3738 this . _app . use ( cookieParser ( ) )
3839 this . _app . use ( helmet ( ) )
Original file line number Diff line number Diff line change @@ -3,9 +3,9 @@ import { randomUUID } from 'crypto'
33import path from 'path'
44import pino from 'pino'
55import { pinoHttp } from 'pino-http'
6- import { __dirname } from '~/lib/string'
76
8- const logDir = path . resolve ( `${ __dirname } /logs` )
7+ const dirname = path . join ( __dirname , '../../' )
8+ const logDir = path . resolve ( `${ dirname } /logs` )
99
1010const fileTransport = pino . transport ( {
1111 target : 'pino/file' ,
Original file line number Diff line number Diff line change @@ -4,10 +4,11 @@ import { addDays } from 'date-fns'
44import fs from 'fs'
55import path from 'path'
66import { logger } from '~/config/logger'
7- import { __dirname } from '~/lib/string'
87import { ms } from '../date'
98import { GoogleCloudStorageParams , UploadFileParams } from './types'
109
10+ const dirname = path . join ( __dirname , '../../../' )
11+
1112export default class GoogleCloudStorage {
1213 public client : GCS . Storage
1314
@@ -20,7 +21,7 @@ export default class GoogleCloudStorage {
2021 this . _access_key = params . access_key
2122 this . _bucket = params . bucket
2223 this . _expires = params . expires
23- this . _filepath = path . resolve ( `${ __dirname } /${ params . filepath } ` )
24+ this . _filepath = path . resolve ( `${ dirname } /${ params . filepath } ` )
2425
2526 const msgType = `${ green ( 'storage - google cloud storage' ) } `
2627
Load Diff This file was deleted.
Original file line number Diff line number Diff line change @@ -3,10 +3,10 @@ import _ from 'lodash'
33import path from 'path'
44import swaggerJSDoc from 'swagger-jsdoc'
55import { env } from '~/config/env'
6- import { __dirname , require } from '../string'
76
8- const _pathRouteDocs = path . resolve ( `${ __dirname } /public/swagger/routes` )
9- const _pathSchemaDocs = path . resolve ( `${ __dirname } /public/swagger/schema` )
7+ const dirname = path . join ( __dirname , '../../../' , 'public' , 'swagger' )
8+ const _pathRouteDocs = path . resolve ( `${ dirname } /routes` )
9+ const _pathSchemaDocs = path . resolve ( `${ dirname } /schema` )
1010
1111function _getDocsSwaggers ( _path : string | Buffer ) : Record < string , unknown > {
1212 return fs . readdirSync ( _path ) . reduce ( ( acc , file ) => {
You can’t perform that action at this time.
0 commit comments