mirror of
https://github.com/strapi/strapi.git
synced 2025-08-22 07:38:41 +00:00
1 line
29 KiB
JavaScript
1 line
29 KiB
JavaScript
![]() |
(window.webpackJsonp=window.webpackJsonp||[]).push([[62],{177:function(t,s,a){"use strict";a.r(s);var n=a(0),e=Object(n.a)({},function(){var t=this,s=t.$createElement,a=t._self._c||s;return a("div",{staticClass:"content"},[t._m(0),t._v(" "),a("p",[t._v("This section explains how the 'back-end part' of your plugin works.")]),t._v(" "),t._m(1),t._v(" "),t._m(2),t._v(" "),a("div",{staticClass:"note custom-block"},[a("p",[t._v("Please refer to "),a("router-link",{attrs:{to:"./../guides/routing.html"}},[t._v("router documentation")]),t._v(" for informations.")],1)]),t._v(" "),t._m(3),t._v(" "),t._m(4),t._v(" "),t._m(5),t._v(" "),t._m(6),t._m(7),t._v(" "),a("p",[t._v("The CLI can be used to generate files in the plugins folders.")]),t._v(" "),a("p",[t._v("Please refer to the "),a("router-link",{attrs:{to:"./../cli/CLI.html"}},[t._v("CLI documentation")]),t._v(" for more informations.")],1),t._v(" "),t._m(8),t._v(" "),a("p",[t._v("Controllers contain functions executed according to the requested route.")]),t._v(" "),a("p",[t._v("Please refer to the "),a("router-link",{attrs:{to:"./../guides/controllers.html"}},[t._v("Controllers documentation")]),t._v(" for more informations.")],1),t._v(" "),t._m(9),t._v(" "),a("p",[t._v("A plugin can have its own models.")]),t._v(" "),t._m(10),t._v(" "),a("p",[t._v("Sometimes it happens that the plugins inject models that have the same name as yours. Let's take a quick example.")]),t._v(" "),t._m(11),t._v(" "),t._m(12),t._m(13),t._v(" "),a("p",[t._v("Please refer to the "),a("router-link",{attrs:{to:"./../guides/models.html"}},[t._v("Models documentation")]),t._v(" for more informations.")],1),t._v(" "),t._m(14),t._v(" "),t._m(15),t._v(" "),a("p",[t._v("A plugin can also use a globally exposed policy in the current Strapi project.")]),t._v(" "),t._m(16),t._m(17),t._v(" "),t._m(18),t._v(" "),t._m(19),a("p",[t._v("Please refer to the "),a("router-link",{attrs:{to:"./../guides/policies.html"}},[t._v("Policies documentation")]),t._v(" for more informations.")],1),t._v(" "),t._m(20),t._v(" "),t._m(21),t._v(" "),t._m(22),t._v(" "),t._m(23),t._v(" "),a("p",[t._v("Mongoose ORM queries definition:")]),t._v(" "),t._m(24),t._v(" "),t._m(25),a("p",[t._v("Bookshelf ORM queries definition:")]),t._v(" "),t._m(26),t._v(" "),t._m(27),a("p",[t._v("Usage from the plugin:")]),t._v(" "),t._m(28),t._v(" "),t._m(29),t._m(30),t._v(" "),a("p",[t._v("Each function in the query file is bound with the ORM's model. It means that you can create generic query very easily. This feature is useful for CRUD such as we did in the "),a("a",{attrs:{href:"https://github.com/strapi/strapi/tree/master/packages/strapi-plugin-content-manager/config/queries",target:"_blank",rel:"noopener noreferrer"}},[t._v("Content Manager plugin"),a("OutboundLink")],1),t._v(".")]),t._v(" "),a("p",[t._v("Mongoose ORM generic queries:")]),t._v(" "),t._m(31),t._v(" "),t._m(32),a("p",[t._v("Bookshelf ORM generic queries:")]),t._v(" "),t._m(33),t._v(" "),t._m(34),a("p",[t._v("Usage from the plugin:")]),t._v(" "),t._m(35),t._v(" "),t._m(36),a("hr")])},[function(){var t=this.$createElement,s=this._self._c||t;return s("h1",{attrs:{id:"back-end-development"}},[s("a",{staticClass:"header-anchor",attrs:{href:"#back-end-development","aria-hidden":"true"}},[this._v("#")]),this._v(" Back-end Development")])},function(){var t=this.$createElement,s=this._self._c||t;return s("h2",{attrs:{id:"routes"}},[s("a",{staticClass:"header-anchor",attrs:{href:"#routes","aria-hidden":"true"}},[this._v("#")]),this._v(" Routes")])},function(){var t=this.$createElement,s=this._self._c||t;return s("p",[this._v("The plugin API routes are defined in the "),s("code",[this._v("./plugins/**/config/routes.json")]),this._v(" file.")])},function(){var t=this.$createElement,s=this._self._c||t;return s("p",[s("strong",[this._v("Route prefix")])])},function(){var t=this.$createElement,s=this._self._c||t;return s("p",[this._v("Each route of a plugin is prefixed by the name of the plugin (eg: "),s("code",[this._v("/my-plugin/my-plugin-route")]),this._v(").")])},function(){var t=this.$createEleme
|