Skip to content

Commit

Permalink
Merge pull request #38 from strapi-community/fix/apiPrefix
Browse files Browse the repository at this point in the history
Add support for Strapi REST API Prefix
  • Loading branch information
stafyniaksacha authored Dec 27, 2022
2 parents 3566903 + eb1735f commit 382a960
Showing 1 changed file with 5 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -123,10 +123,13 @@ function resolveUserStrategy(strapi, userOptions) {
continue;
}

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

// https://docs.strapi.io/developer-docs/latest/developer-resources/database-apis-reference/rest-api.html#api-endpoints
// https://github.com/strapi/strapi/blob/master/packages/core/strapi/lib/core-api/routes/index.js
if (cacheConfig.singleType) {
const base = `/api/${contentType.info.singularName}`;
const base = `${apiPrefix}/${contentType.info.singularName}`;

// delete
cacheConfig.routes.push(
Expand Down Expand Up @@ -155,7 +158,7 @@ function resolveUserStrategy(strapi, userOptions) {
})
);
} else {
const base = `/api/${contentType.info.pluralName}`;
const base = `${apiPrefix}/${contentType.info.pluralName}`;

// create
cacheConfig.routes.push(
Expand Down

0 comments on commit 382a960

Please sign in to comment.