Skip to content

Commit

Permalink
fixed harding api and removed not used stuff
Browse files Browse the repository at this point in the history
  • Loading branch information
Boegie19 committed Oct 12, 2023
1 parent 7b32656 commit 2c55dd8
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 36 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,8 @@
* @typedef {import('@strapi/strapi').Strapi} Strapi
*/

const debug = require('debug')('strapi:strapi-plugin-rest-cache');
const { getRelatedModelsUid } = require('./getRelatedModelsUid');
const { deepFreeze } = require('./deepFreeze');
const { routeExists } = require('./routeExists');
const {
CachePluginStrategy,
CacheRouteConfig,
Expand Down Expand Up @@ -144,7 +142,7 @@ function resolveUserStrategy(strapi, userOptions) {
) {
cacheConfig.routes.push(
new CacheRouteConfig({
path: `/api${route.path}`,
path: `/${apiPrefix}${route.path}`,
paramNames: route.path.match(routeParams) ?? [],
method: route.method,
keys: new CacheKeysConfig(cacheConfig.keys),
Expand All @@ -162,7 +160,7 @@ function resolveUserStrategy(strapi, userOptions) {
) {
cacheConfig.routes.push(
new CacheRouteConfig({
path: `/api${route.path}`,
path: `/${apiPrefix}${route.path}`,
paramNames: route.path.match(routeParams) ?? [],
method: route.method,
keys: new CacheKeysConfig(cacheConfig.keys),
Expand All @@ -177,7 +175,7 @@ function resolveUserStrategy(strapi, userOptions) {
) {
cacheConfig.routes.push(
new CacheRouteConfig({
path: `/api${route.path}`,
path: `/${apiPrefix}${route.path}`,
paramNames: route.path.match(routeParams) ?? [],
method: route.method,
keys: new CacheKeysConfig(cacheConfig.keys),
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,18 @@
* @param {Strapi} strapi
* @return {void}
*/

function flattenRoutes(strapi) {
let routes = [];
for (const contentTypes of Object.values(strapi.api)) {
routes = routes.concat(flatten(contentTypes));
}
// @TODO add prefix support before doing this

const apiPrefix = strapi.config.get('api.rest.prefix');

for (const route of routes) {
route.globalPath = `/api${route.path}`;
route.globalPath = `/${apiPrefix}${route.path}`;
}
return routes;
}
Expand Down

0 comments on commit 2c55dd8

Please sign in to comment.