import { FastifyInstance } from 'fastify'
import { handleError } from '../../utils/errorHandler.js'

export default async function (fastify: FastifyInstance) {
  fastify.get('/', async (request, reply) => {
    try {
      return {
        message:
          `Hello ! See documentation at ${request.protocol}://${request.hostname}/documentation`
      }
    } catch (error) {
      return handleError(request, reply, error, 'api-root');
    }
  })
}
