text: 'use strict'
  import feathers from '@feathersjs/feathers'
  import express from '@feathersjs/express'
  import {country} from 'model/country'
  import {logger} from 'utils/logger'
  
  const app = express( feathers() )
  
  const response = ( status, data, res ) => {
  	res.status( status )
  	res.send( JSON.stringify( data ) )
  }
  
  app.get( '/', async ( req, res ) => {
  	try {
  		const result = await country.find()
  		response( 200, result, res )
  	} catch ( e ) {
  		response( 400, {error: 'error_retrieving_data'}, res )
  		logger( e )
  	}
  })
  
  app.get( '/:countryID', async ( req, res ) => {
  	try {
  		const result = await country.findById({_id: req.params.countryID})
  		response( 200, result, res )
  	} catch ( e ) {
  		response( 400, {error: 'error_retrieving_data'}, res )
  		logger( e )
  	}
  })
  
  export default app
  