0

I have this code written in index.js file. My api's are running successfully on the / path. Now I need add a prefix to all my api's. I don't want to add one by one by editing each file. I need to do in one go.

composer((err, server) => {
  if (err) throw err

  server.initialize((errInit) => {
    if (err) throw errInit
    server.register({
      register: require('hapi-cron'),
      routes: { prefix: '/api' },
      options: {
        jobs: []
      }  
    }, (err) => {
      server.start(() => {
        const env = process.env.NODE_ENV
        const msg = `${env} server started at ${server.info.uri}`
        server.log(['server', 'info'], msg)
        if (_.includes(['sandbox', 'production'], env)) {
        }
      })    
    })   
  })
})

How Can I do this? Thank in advance!!!

Profer
  • 553
  • 8
  • 40
  • 81

0 Answers0