<commit_before>'use strict';

const { isSingleType } = require('@strapi/utils').contentTypes;

const createRoutes = ({ contentType }) => {
  if (isSingleType(contentType)) {
    return getSingleTypeRoutes(contentType);
  }

  return getCollectionTypeRoutes(contentType);
};

const getSingleTypeRoutes = ({ uid, info }) => {
  return {
    find: {
      method: 'GET',
      path: `/${info.pluralName}`,
      handler: `${uid}.find`,
      config: {},
    },
    update: {
      method: 'PUT',
      path: `/${info.pluralName}`,
      handler: `${uid}.update`,
      config: {},
    },
    delete: {
      method: 'DELETE',
      path: `/${info.pluralName}`,
      handler: `${uid}.delete`,
      config: {},
    },
  };
};

const getCollectionTypeRoutes = ({ uid, info }) => {
  return {
    find: {
      method: 'GET',<commit_msg>Fix single types routes<commit_after>'use strict';

const { isSingleType } = require('@strapi/utils').contentTypes;

const createRoutes = ({ contentType }) => {
  if (isSingleType(contentType)) {
    return getSingleTypeRoutes(contentType);
  }

  return getCollectionTypeRoutes(contentType);
};

const getSingleTypeRoutes = ({ uid, info }) => {
  return {
    find: {
      method: 'GET',
      path: `/${info.singularName}`,
      handler: `${uid}.find`,
      config: {},
    },
    update: {
      method: 'PUT',
      path: `/${info.singularName}`,
      handler: `${uid}.update`,
      config: {},
    },
    delete: {
      method: 'DELETE',
      path: `/${info.singularName}`,
      handler: `${uid}.delete`,
      config: {},
    },
  };
};

const getCollectionTypeRoutes = ({ uid, info }) => {
  return {
    find: {
      method: 'GET',
{'fraction_non_alphanumeric': 0.18571428571428572, 'fraction_numerical': 0.0, 'mean_word_length': 2.7355555555555555, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 9, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2395987', 'n_tokens_mistral': 542, 'n_tokens_neox': 548, 'n_words': 104}