/ live.thehmm.nl / back / node_modules / strapi-plugin-transformer /

[ICO]NameLast modifiedSizeDescription
[PARENTDIR]Parent Directory  -  
[DIR]server/2 years ago -  
[   ]LICENSE40 years ago1.0K 
[TXT]README.md40 years ago2.7Kd7c1522 post receive test [كارل مبارك]
[   ]jest.config.js40 years ago253  
[   ]package.json2 years ago2.5K 
[   ]strapi-server.js40 years ago 53  
README.md

strapi-plugin-transformer

A plugin for Strapi that provides the ability to transform the API response.

Downloads Install size Package version

Requirements

The installation requirements are the same as Strapi itself and can be found in the documentation on the Quick Start page in the Prerequisites info card.

Supported Strapi versions

NOTE: While this plugin may work with the older Strapi versions, they are not supported, it is always recommended to use the latest version of Strapi.

Installation

npm install strapi-plugin-transformer

or

yarn add strapi-plugin-transformer

Configuration

The plugin configuration is stored in a config file located at ./config/plugins.js.

module.exports = ({ env }) => ({
 'transformer': {
    enabled: true,
    config: {
      prefix: '/api/'
    }
  },
});

IMPORTANT NOTE: Make sure any sensitive data is stored in env files.

The Complete Plugin Configuration Object

Property Description Type Default Required
prefix The prefix for the API String '/api/' No

Usage

Once the plugin has been installed, configured and enabled any request to the Strapi API will be auto transformed.

Current Supported Transformations

Remove the attributes key and shift all of its properties up a level

Before

{
  "data": {
    "id": 1,
    "attributes": {
      "title": "the title",
      "createdAt": "2022-02-11T01:51:49.902Z",
      "updatedAt": "2022-02-11T01:51:52.797Z",
      "publishedAt": "2022-02-11T01:51:52.794Z",
    },
  },
  "meta": {},
}

After

{
  "data": {
    "id": 1,
    "title": "the title",
    "createdAt": "2022-02-11T01:51:49.902Z",
    "updatedAt": "2022-02-11T01:51:52.797Z",
    "publishedAt": "2022-02-11T01:51:52.794Z",
  },
  "meta": {},
}

Bugs

If any bugs are found please report them as a Github Issue

Apache/2.4.38 (Debian) Server at www.karls.computer Port 80