const { Router }  = require('express')
const application = require('../package.json')

const api = (app) => {
  let api = Router()

  api.get('/', (req, res, next) => {
    res.json({
      name: application.name,
      description: application.description,
      version: application.version
    })

    next()
  })

  return api
}

module.exports = api

const { Router }     = require('express')
const authMiddleware = require('./../middlewares/authentication')

const api = (app) => {
  let api = Router()

  api.use(authMiddleware)

  api.get('/', (req, res) => {
    res.send('Ok')
  })

  return api
}

module.exports = api

Remove api index route and setup auth middleware