E
E
Egor Vinogradov2022-04-13 19:42:56
JavaScript
Egor Vinogradov, 2022-04-13 19:42:56

How to get data from export?

There are two files, here is the desired content:

import 'module-alias/register'
import 'source-map-support/register'
import runApp from '@/helpers/runApp'
import router from '@/helpers/runApp'
import runMongo from '@/helpers/mongo'

void (async () => {
  await runMongo()
  console.log('Mongo connected')
  await runApp()
})()

import file
export default async function () {
  const router = new Router()
  await bootstrapControllers({
    app,
    router,
    basePath: '/',
    controllers: [resolve(__dirname, '../controllers/*')],
    disableVersioning: true,
  })
  app.use(cors({ origin: '*' }))
  app.use(bodyParser())
  app.use(router.routes())
  app.use(router.allowedMethods())
  return new Promise<Server>((resolve, reject) => {
    const connection = app
      .listen(env.PORT)
      .on('listening', () => {
        console.log(`HTTP is listening on ${env.PORT}`)
        resolve(connection)
      })
      .on('error', reject)
  })
}

export from another file.
How to get data from export, and specifically access to the Router variable?

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question