mirror of
https://github.com/strapi/strapi.git
synced 2025-10-19 12:02:38 +00:00
Migrate code and remove auto generation of controller and services in memory
This commit is contained in:
parent
d709898a82
commit
7697bb16c3
@ -0,0 +1,5 @@
|
|||||||
|
'use strict';
|
||||||
|
|
||||||
|
const { createCoreController } = require('@strapi/strapi').factories;
|
||||||
|
|
||||||
|
module.exports = createCoreController('api::category.category');
|
@ -1,46 +1,5 @@
|
|||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
module.exports = {
|
const { createCoreRouter } = require('@strapi/strapi').factories;
|
||||||
routes: [
|
|
||||||
{
|
module.exports = createCoreRouter('api::category.category');
|
||||||
method: 'GET',
|
|
||||||
path: '/categories',
|
|
||||||
handler: 'category.find',
|
|
||||||
config: {
|
|
||||||
policies: [],
|
|
||||||
},
|
|
||||||
},
|
|
||||||
{
|
|
||||||
method: 'GET',
|
|
||||||
path: '/categories/:id',
|
|
||||||
handler: 'category.findOne',
|
|
||||||
config: {
|
|
||||||
policies: [],
|
|
||||||
},
|
|
||||||
},
|
|
||||||
{
|
|
||||||
method: 'POST',
|
|
||||||
path: '/categories',
|
|
||||||
handler: 'category.create',
|
|
||||||
config: {
|
|
||||||
policies: [],
|
|
||||||
},
|
|
||||||
},
|
|
||||||
{
|
|
||||||
method: 'PUT',
|
|
||||||
path: '/categories/:id',
|
|
||||||
handler: 'category.update',
|
|
||||||
config: {
|
|
||||||
policies: [],
|
|
||||||
},
|
|
||||||
},
|
|
||||||
{
|
|
||||||
method: 'DELETE',
|
|
||||||
path: '/categories/:id',
|
|
||||||
handler: 'category.delete',
|
|
||||||
config: {
|
|
||||||
policies: [],
|
|
||||||
},
|
|
||||||
},
|
|
||||||
],
|
|
||||||
};
|
|
||||||
|
@ -0,0 +1,5 @@
|
|||||||
|
'use strict';
|
||||||
|
|
||||||
|
const { createCoreService } = require('@strapi/strapi').factories;
|
||||||
|
|
||||||
|
module.exports = createCoreService('api::category.category');
|
@ -0,0 +1,5 @@
|
|||||||
|
'use strict';
|
||||||
|
|
||||||
|
const { createCoreController } = require('@strapi/strapi').factories;
|
||||||
|
|
||||||
|
module.exports = createCoreController('api::country.country');
|
@ -1,46 +1,5 @@
|
|||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
module.exports = {
|
const { createCoreRouter } = require('@strapi/strapi').factories;
|
||||||
routes: [
|
|
||||||
{
|
module.exports = createCoreRouter('api::country.country');
|
||||||
method: 'GET',
|
|
||||||
path: '/countries',
|
|
||||||
handler: 'country.find',
|
|
||||||
config: {
|
|
||||||
policies: [],
|
|
||||||
},
|
|
||||||
},
|
|
||||||
{
|
|
||||||
method: 'GET',
|
|
||||||
path: '/countries/:id',
|
|
||||||
handler: 'country.findOne',
|
|
||||||
config: {
|
|
||||||
policies: [],
|
|
||||||
},
|
|
||||||
},
|
|
||||||
{
|
|
||||||
method: 'POST',
|
|
||||||
path: '/countries',
|
|
||||||
handler: 'country.create',
|
|
||||||
config: {
|
|
||||||
policies: [],
|
|
||||||
},
|
|
||||||
},
|
|
||||||
{
|
|
||||||
method: 'PUT',
|
|
||||||
path: '/countries/:id',
|
|
||||||
handler: 'country.update',
|
|
||||||
config: {
|
|
||||||
policies: [],
|
|
||||||
},
|
|
||||||
},
|
|
||||||
{
|
|
||||||
method: 'DELETE',
|
|
||||||
path: '/countries/:id',
|
|
||||||
handler: 'country.delete',
|
|
||||||
config: {
|
|
||||||
policies: [],
|
|
||||||
},
|
|
||||||
},
|
|
||||||
],
|
|
||||||
};
|
|
||||||
|
5
examples/getstarted/src/api/country/services/country.js
Normal file
5
examples/getstarted/src/api/country/services/country.js
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
'use strict';
|
||||||
|
|
||||||
|
const { createCoreService } = require('@strapi/strapi').factories;
|
||||||
|
|
||||||
|
module.exports = createCoreService('api::country.country');
|
@ -0,0 +1,5 @@
|
|||||||
|
'use strict';
|
||||||
|
|
||||||
|
const { createCoreController } = require('@strapi/strapi').factories;
|
||||||
|
|
||||||
|
module.exports = createCoreController('api::homepage.homepage');
|
@ -1,30 +1,5 @@
|
|||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
module.exports = {
|
const { createCoreRouter } = require('@strapi/strapi').factories;
|
||||||
routes: [
|
|
||||||
{
|
module.exports = createCoreRouter('api::homepage.homepage');
|
||||||
method: 'GET',
|
|
||||||
path: '/homepage',
|
|
||||||
handler: 'homepage.find',
|
|
||||||
config: {
|
|
||||||
policies: [],
|
|
||||||
},
|
|
||||||
},
|
|
||||||
{
|
|
||||||
method: 'PUT',
|
|
||||||
path: '/homepage',
|
|
||||||
handler: 'homepage.update',
|
|
||||||
config: {
|
|
||||||
policies: [],
|
|
||||||
},
|
|
||||||
},
|
|
||||||
{
|
|
||||||
method: 'DELETE',
|
|
||||||
path: '/homepage',
|
|
||||||
handler: 'homepage.delete',
|
|
||||||
config: {
|
|
||||||
policies: [],
|
|
||||||
},
|
|
||||||
},
|
|
||||||
],
|
|
||||||
};
|
|
||||||
|
@ -0,0 +1,5 @@
|
|||||||
|
'use strict';
|
||||||
|
|
||||||
|
const { createCoreService } = require('@strapi/strapi').factories;
|
||||||
|
|
||||||
|
module.exports = createCoreService('api::homepage.homepage');
|
@ -0,0 +1,5 @@
|
|||||||
|
'use strict';
|
||||||
|
|
||||||
|
const { createCoreController } = require('@strapi/strapi').factories;
|
||||||
|
|
||||||
|
module.exports = createCoreController('api::kitchensink.kitchensink');
|
@ -1,46 +1,5 @@
|
|||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
module.exports = {
|
const { createCoreRouter } = require('@strapi/strapi').factories;
|
||||||
routes: [
|
|
||||||
{
|
module.exports = createCoreRouter('api::kitchensink.kitchensink');
|
||||||
method: 'GET',
|
|
||||||
path: '/kitchensinks',
|
|
||||||
handler: 'kitchensink.find',
|
|
||||||
config: {
|
|
||||||
policies: [],
|
|
||||||
},
|
|
||||||
},
|
|
||||||
{
|
|
||||||
method: 'GET',
|
|
||||||
path: '/kitchensinks/:id',
|
|
||||||
handler: 'kitchensink.findOne',
|
|
||||||
config: {
|
|
||||||
policies: [],
|
|
||||||
},
|
|
||||||
},
|
|
||||||
{
|
|
||||||
method: 'POST',
|
|
||||||
path: '/kitchensinks',
|
|
||||||
handler: 'kitchensink.create',
|
|
||||||
config: {
|
|
||||||
policies: [],
|
|
||||||
},
|
|
||||||
},
|
|
||||||
{
|
|
||||||
method: 'PUT',
|
|
||||||
path: '/kitchensinks/:id',
|
|
||||||
handler: 'kitchensink.update',
|
|
||||||
config: {
|
|
||||||
policies: [],
|
|
||||||
},
|
|
||||||
},
|
|
||||||
{
|
|
||||||
method: 'DELETE',
|
|
||||||
path: '/kitchensinks/:id',
|
|
||||||
handler: 'kitchensink.delete',
|
|
||||||
config: {
|
|
||||||
policies: [],
|
|
||||||
},
|
|
||||||
},
|
|
||||||
],
|
|
||||||
};
|
|
||||||
|
@ -0,0 +1,5 @@
|
|||||||
|
'use strict';
|
||||||
|
|
||||||
|
const { createCoreService } = require('@strapi/strapi').factories;
|
||||||
|
|
||||||
|
module.exports = createCoreService('api::kitchensink.kitchensink');
|
5
examples/getstarted/src/api/like/controllers/like.js
Normal file
5
examples/getstarted/src/api/like/controllers/like.js
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
'use strict';
|
||||||
|
|
||||||
|
const { createCoreController } = require('@strapi/strapi').factories;
|
||||||
|
|
||||||
|
module.exports = createCoreController('api::like.like');
|
@ -1,46 +1,5 @@
|
|||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
module.exports = {
|
const { createCoreRouter } = require('@strapi/strapi').factories;
|
||||||
routes: [
|
|
||||||
{
|
module.exports = createCoreRouter('api::like.like');
|
||||||
method: 'GET',
|
|
||||||
path: '/likes',
|
|
||||||
handler: 'like.find',
|
|
||||||
config: {
|
|
||||||
policies: [],
|
|
||||||
},
|
|
||||||
},
|
|
||||||
{
|
|
||||||
method: 'GET',
|
|
||||||
path: '/likes/:id',
|
|
||||||
handler: 'like.findOne',
|
|
||||||
config: {
|
|
||||||
policies: [],
|
|
||||||
},
|
|
||||||
},
|
|
||||||
{
|
|
||||||
method: 'POST',
|
|
||||||
path: '/likes',
|
|
||||||
handler: 'like.create',
|
|
||||||
config: {
|
|
||||||
policies: [],
|
|
||||||
},
|
|
||||||
},
|
|
||||||
{
|
|
||||||
method: 'PUT',
|
|
||||||
path: '/likes/:id',
|
|
||||||
handler: 'like.update',
|
|
||||||
config: {
|
|
||||||
policies: [],
|
|
||||||
},
|
|
||||||
},
|
|
||||||
{
|
|
||||||
method: 'DELETE',
|
|
||||||
path: '/likes/:id',
|
|
||||||
handler: 'like.delete',
|
|
||||||
config: {
|
|
||||||
policies: [],
|
|
||||||
},
|
|
||||||
},
|
|
||||||
],
|
|
||||||
};
|
|
||||||
|
5
examples/getstarted/src/api/like/services/like.js
Normal file
5
examples/getstarted/src/api/like/services/like.js
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
'use strict';
|
||||||
|
|
||||||
|
const { createCoreService } = require('@strapi/strapi').factories;
|
||||||
|
|
||||||
|
module.exports = createCoreService('api::like.like');
|
5
examples/getstarted/src/api/menu/controllers/menu.js
Normal file
5
examples/getstarted/src/api/menu/controllers/menu.js
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
'use strict';
|
||||||
|
|
||||||
|
const { createCoreController } = require('@strapi/strapi').factories;
|
||||||
|
|
||||||
|
module.exports = createCoreController('api::menu.menu');
|
@ -1,46 +1,5 @@
|
|||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
module.exports = {
|
const { createCoreRouter } = require('@strapi/strapi').factories;
|
||||||
routes: [
|
|
||||||
{
|
module.exports = createCoreRouter('api::menu.menu');
|
||||||
method: 'GET',
|
|
||||||
path: '/menus',
|
|
||||||
handler: 'menu.find',
|
|
||||||
config: {
|
|
||||||
policies: [],
|
|
||||||
},
|
|
||||||
},
|
|
||||||
{
|
|
||||||
method: 'GET',
|
|
||||||
path: '/menus/:id',
|
|
||||||
handler: 'menu.findOne',
|
|
||||||
config: {
|
|
||||||
policies: [],
|
|
||||||
},
|
|
||||||
},
|
|
||||||
{
|
|
||||||
method: 'POST',
|
|
||||||
path: '/menus',
|
|
||||||
handler: 'menu.create',
|
|
||||||
config: {
|
|
||||||
policies: [],
|
|
||||||
},
|
|
||||||
},
|
|
||||||
{
|
|
||||||
method: 'PUT',
|
|
||||||
path: '/menus/:id',
|
|
||||||
handler: 'menu.update',
|
|
||||||
config: {
|
|
||||||
policies: [],
|
|
||||||
},
|
|
||||||
},
|
|
||||||
{
|
|
||||||
method: 'DELETE',
|
|
||||||
path: '/menus/:id',
|
|
||||||
handler: 'menu.delete',
|
|
||||||
config: {
|
|
||||||
policies: [],
|
|
||||||
},
|
|
||||||
},
|
|
||||||
],
|
|
||||||
};
|
|
||||||
|
5
examples/getstarted/src/api/menu/services/menu.js
Normal file
5
examples/getstarted/src/api/menu/services/menu.js
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
'use strict';
|
||||||
|
|
||||||
|
const { createCoreService } = require('@strapi/strapi').factories;
|
||||||
|
|
||||||
|
module.exports = createCoreService('api::menu.menu');
|
@ -0,0 +1,5 @@
|
|||||||
|
'use strict';
|
||||||
|
|
||||||
|
const { createCoreController } = require('@strapi/strapi').factories;
|
||||||
|
|
||||||
|
module.exports = createCoreController('api::menusection.menusection');
|
@ -1,46 +1,5 @@
|
|||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
module.exports = {
|
const { createCoreRouter } = require('@strapi/strapi').factories;
|
||||||
routes: [
|
|
||||||
{
|
module.exports = createCoreRouter('api::menusection.menusection');
|
||||||
method: 'GET',
|
|
||||||
path: '/menusections',
|
|
||||||
handler: 'menusection.find',
|
|
||||||
config: {
|
|
||||||
policies: [],
|
|
||||||
},
|
|
||||||
},
|
|
||||||
{
|
|
||||||
method: 'GET',
|
|
||||||
path: '/menusections/:id',
|
|
||||||
handler: 'menusection.findOne',
|
|
||||||
config: {
|
|
||||||
policies: [],
|
|
||||||
},
|
|
||||||
},
|
|
||||||
{
|
|
||||||
method: 'POST',
|
|
||||||
path: '/menusections',
|
|
||||||
handler: 'menusection.create',
|
|
||||||
config: {
|
|
||||||
policies: [],
|
|
||||||
},
|
|
||||||
},
|
|
||||||
{
|
|
||||||
method: 'PUT',
|
|
||||||
path: '/menusections/:id',
|
|
||||||
handler: 'menusection.update',
|
|
||||||
config: {
|
|
||||||
policies: [],
|
|
||||||
},
|
|
||||||
},
|
|
||||||
{
|
|
||||||
method: 'DELETE',
|
|
||||||
path: '/menusections/:id',
|
|
||||||
handler: 'menusection.delete',
|
|
||||||
config: {
|
|
||||||
policies: [],
|
|
||||||
},
|
|
||||||
},
|
|
||||||
],
|
|
||||||
};
|
|
||||||
|
@ -0,0 +1,5 @@
|
|||||||
|
'use strict';
|
||||||
|
|
||||||
|
const { createCoreService } = require('@strapi/strapi').factories;
|
||||||
|
|
||||||
|
module.exports = createCoreService('api::menusection.menusection');
|
@ -0,0 +1,5 @@
|
|||||||
|
'use strict';
|
||||||
|
|
||||||
|
const { createCoreController } = require('@strapi/strapi').factories;
|
||||||
|
|
||||||
|
module.exports = createCoreController('api::restaurant.restaurant');
|
@ -1,47 +1,5 @@
|
|||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
module.exports = {
|
const { createCoreRouter } = require('@strapi/strapi').factories;
|
||||||
prefix: '/restaurants',
|
|
||||||
routes: [
|
module.exports = createCoreRouter('api::restaurant.restaurant');
|
||||||
{
|
|
||||||
method: 'GET',
|
|
||||||
path: '/',
|
|
||||||
handler: 'restaurant.find',
|
|
||||||
config: {
|
|
||||||
policies: [],
|
|
||||||
},
|
|
||||||
},
|
|
||||||
{
|
|
||||||
method: 'GET',
|
|
||||||
path: '/:id',
|
|
||||||
handler: 'restaurant.findOne',
|
|
||||||
config: {
|
|
||||||
policies: [],
|
|
||||||
},
|
|
||||||
},
|
|
||||||
{
|
|
||||||
method: 'POST',
|
|
||||||
path: '/',
|
|
||||||
handler: 'restaurant.create',
|
|
||||||
config: {
|
|
||||||
policies: [],
|
|
||||||
},
|
|
||||||
},
|
|
||||||
{
|
|
||||||
method: 'PUT',
|
|
||||||
path: '/:id',
|
|
||||||
handler: 'restaurant.update',
|
|
||||||
config: {
|
|
||||||
policies: [],
|
|
||||||
},
|
|
||||||
},
|
|
||||||
{
|
|
||||||
method: 'DELETE',
|
|
||||||
path: '/:id',
|
|
||||||
handler: 'restaurant.delete',
|
|
||||||
config: {
|
|
||||||
policies: [],
|
|
||||||
},
|
|
||||||
},
|
|
||||||
],
|
|
||||||
};
|
|
||||||
|
@ -0,0 +1,5 @@
|
|||||||
|
'use strict';
|
||||||
|
|
||||||
|
const { createCoreService } = require('@strapi/strapi').factories;
|
||||||
|
|
||||||
|
module.exports = createCoreService('api::restaurant.restaurant');
|
5
examples/getstarted/src/api/review/controllers/review.js
Normal file
5
examples/getstarted/src/api/review/controllers/review.js
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
'use strict';
|
||||||
|
|
||||||
|
const { createCoreController } = require('@strapi/strapi').factories;
|
||||||
|
|
||||||
|
module.exports = createCoreController('api::review.review');
|
@ -1,46 +1,5 @@
|
|||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
module.exports = {
|
const { createCoreRouter } = require('@strapi/strapi').factories;
|
||||||
routes: [
|
|
||||||
{
|
module.exports = createCoreRouter('api::review.review');
|
||||||
method: 'GET',
|
|
||||||
path: '/reviews',
|
|
||||||
handler: 'review.find',
|
|
||||||
config: {
|
|
||||||
policies: [],
|
|
||||||
},
|
|
||||||
},
|
|
||||||
{
|
|
||||||
method: 'GET',
|
|
||||||
path: '/reviews/:id',
|
|
||||||
handler: 'review.findOne',
|
|
||||||
config: {
|
|
||||||
policies: [],
|
|
||||||
},
|
|
||||||
},
|
|
||||||
{
|
|
||||||
method: 'POST',
|
|
||||||
path: '/reviews',
|
|
||||||
handler: 'review.create',
|
|
||||||
config: {
|
|
||||||
policies: [],
|
|
||||||
},
|
|
||||||
},
|
|
||||||
{
|
|
||||||
method: 'PUT',
|
|
||||||
path: '/reviews/:id',
|
|
||||||
handler: 'review.update',
|
|
||||||
config: {
|
|
||||||
policies: [],
|
|
||||||
},
|
|
||||||
},
|
|
||||||
{
|
|
||||||
method: 'DELETE',
|
|
||||||
path: '/reviews/:id',
|
|
||||||
handler: 'review.delete',
|
|
||||||
config: {
|
|
||||||
policies: [],
|
|
||||||
},
|
|
||||||
},
|
|
||||||
],
|
|
||||||
};
|
|
||||||
|
5
examples/getstarted/src/api/review/services/review.js
Normal file
5
examples/getstarted/src/api/review/services/review.js
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
'use strict';
|
||||||
|
|
||||||
|
const { createCoreService } = require('@strapi/strapi').factories;
|
||||||
|
|
||||||
|
module.exports = createCoreService('api::review.review');
|
5
examples/getstarted/src/api/tag/controllers/tag.js
Normal file
5
examples/getstarted/src/api/tag/controllers/tag.js
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
'use strict';
|
||||||
|
|
||||||
|
const { createCoreController } = require('@strapi/strapi').factories;
|
||||||
|
|
||||||
|
module.exports = createCoreController('api::tag.tag');
|
@ -1,46 +1,5 @@
|
|||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
module.exports = {
|
const { createCoreRouter } = require('@strapi/strapi').factories;
|
||||||
routes: [
|
|
||||||
{
|
module.exports = createCoreRouter('api::tag.tag');
|
||||||
method: 'GET',
|
|
||||||
path: '/tags',
|
|
||||||
handler: 'tag.find',
|
|
||||||
config: {
|
|
||||||
policies: [],
|
|
||||||
},
|
|
||||||
},
|
|
||||||
{
|
|
||||||
method: 'GET',
|
|
||||||
path: '/tags/:id',
|
|
||||||
handler: 'tag.findOne',
|
|
||||||
config: {
|
|
||||||
policies: [],
|
|
||||||
},
|
|
||||||
},
|
|
||||||
{
|
|
||||||
method: 'POST',
|
|
||||||
path: '/tags',
|
|
||||||
handler: 'tag.create',
|
|
||||||
config: {
|
|
||||||
policies: [],
|
|
||||||
},
|
|
||||||
},
|
|
||||||
{
|
|
||||||
method: 'PUT',
|
|
||||||
path: '/tags/:id',
|
|
||||||
handler: 'tag.update',
|
|
||||||
config: {
|
|
||||||
policies: [],
|
|
||||||
},
|
|
||||||
},
|
|
||||||
{
|
|
||||||
method: 'DELETE',
|
|
||||||
path: '/tags/:id',
|
|
||||||
handler: 'tag.delete',
|
|
||||||
config: {
|
|
||||||
policies: [],
|
|
||||||
},
|
|
||||||
},
|
|
||||||
],
|
|
||||||
};
|
|
||||||
|
5
examples/getstarted/src/api/tag/services/tag.js
Normal file
5
examples/getstarted/src/api/tag/services/tag.js
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
'use strict';
|
||||||
|
|
||||||
|
const { createCoreService } = require('@strapi/strapi').factories;
|
||||||
|
|
||||||
|
module.exports = createCoreService('api::tag.tag');
|
5
examples/getstarted/src/api/temp/controllers/temp.js
Normal file
5
examples/getstarted/src/api/temp/controllers/temp.js
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
'use strict';
|
||||||
|
|
||||||
|
const { createCoreController } = require('@strapi/strapi').factories;
|
||||||
|
|
||||||
|
module.exports = createCoreController('api::temp.temp');
|
@ -1,44 +1,5 @@
|
|||||||
module.exports = {
|
'use strict';
|
||||||
routes: [
|
|
||||||
{
|
const { createCoreRouter } = require('@strapi/strapi').factories;
|
||||||
method: 'GET',
|
|
||||||
path: '/temps',
|
module.exports = createCoreRouter('api::temp.temp');
|
||||||
handler: 'temp.find',
|
|
||||||
config: {
|
|
||||||
policies: [],
|
|
||||||
},
|
|
||||||
},
|
|
||||||
{
|
|
||||||
method: 'GET',
|
|
||||||
path: '/temps/:id',
|
|
||||||
handler: 'temp.findOne',
|
|
||||||
config: {
|
|
||||||
policies: [],
|
|
||||||
},
|
|
||||||
},
|
|
||||||
{
|
|
||||||
method: 'POST',
|
|
||||||
path: '/temps',
|
|
||||||
handler: 'temp.create',
|
|
||||||
config: {
|
|
||||||
policies: [],
|
|
||||||
},
|
|
||||||
},
|
|
||||||
{
|
|
||||||
method: 'PUT',
|
|
||||||
path: '/temps/:id',
|
|
||||||
handler: 'temp.update',
|
|
||||||
config: {
|
|
||||||
policies: [],
|
|
||||||
},
|
|
||||||
},
|
|
||||||
{
|
|
||||||
method: 'DELETE',
|
|
||||||
path: '/temps/:id',
|
|
||||||
handler: 'temp.delete',
|
|
||||||
config: {
|
|
||||||
policies: [],
|
|
||||||
},
|
|
||||||
},
|
|
||||||
],
|
|
||||||
};
|
|
||||||
|
5
examples/getstarted/src/api/temp/services/temp.js
Normal file
5
examples/getstarted/src/api/temp/services/temp.js
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
'use strict';
|
||||||
|
|
||||||
|
const { createCoreService } = require('@strapi/strapi').factories;
|
||||||
|
|
||||||
|
module.exports = createCoreService('api::temp.temp');
|
@ -1,8 +1,6 @@
|
|||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
const { has } = require('lodash/fp');
|
const { has } = require('lodash/fp');
|
||||||
const { createService } = require('../../core-api/service');
|
|
||||||
const { createController } = require('../../core-api/controller');
|
|
||||||
|
|
||||||
const apisRegistry = strapi => {
|
const apisRegistry = strapi => {
|
||||||
const apis = {};
|
const apis = {};
|
||||||
@ -21,22 +19,6 @@ const apisRegistry = strapi => {
|
|||||||
|
|
||||||
const api = strapi.container.get('modules').add(`api::${apiName}`, apiConfig);
|
const api = strapi.container.get('modules').add(`api::${apiName}`, apiConfig);
|
||||||
|
|
||||||
for (const ctName in api.contentTypes || {}) {
|
|
||||||
const contentType = api.contentTypes[ctName];
|
|
||||||
|
|
||||||
const uid = `api::${apiName}.${ctName}`;
|
|
||||||
|
|
||||||
if (!has(contentType.modelName, api.services)) {
|
|
||||||
const service = createService({ contentType });
|
|
||||||
strapi.container.get('services').set(uid, service);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!has(contentType.modelName, api.controllers)) {
|
|
||||||
const controller = createController({ contentType });
|
|
||||||
strapi.container.get('controllers').set(uid, controller);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
apis[apiName] = api;
|
apis[apiName] = api;
|
||||||
|
|
||||||
return apis[apiName];
|
return apis[apiName];
|
||||||
|
6
packages/core/strapi/lib/factories.d.ts
vendored
6
packages/core/strapi/lib/factories.d.ts
vendored
@ -1,5 +1,7 @@
|
|||||||
import { Service } from './core-api/service';
|
import { Service } from './core-api/service';
|
||||||
import { Controller } from './core-api/controller';
|
import { Controller } from './core-api/controller';
|
||||||
|
import { Middleware } from './middlewares';
|
||||||
|
import { Policy } from './core/registries/policies';
|
||||||
|
|
||||||
type ControllerConfig = Controller;
|
type ControllerConfig = Controller;
|
||||||
|
|
||||||
@ -7,8 +9,8 @@ type ServiceConfig = Service;
|
|||||||
|
|
||||||
type HandlerConfig = {
|
type HandlerConfig = {
|
||||||
auth: false | { scope: string[] };
|
auth: false | { scope: string[] };
|
||||||
policies: string[];
|
policies: Array<string | Policy>;
|
||||||
middlewares: string[];
|
middlewares: Array<string | Middleware>;
|
||||||
};
|
};
|
||||||
|
|
||||||
type SingleTypeRouterConfig = {
|
type SingleTypeRouterConfig = {
|
||||||
|
@ -2,3 +2,4 @@ import { Strapi } from '../';
|
|||||||
import { Middleware } from 'koa';
|
import { Middleware } from 'koa';
|
||||||
|
|
||||||
export type MiddlewareFactory = (config: any, ctx: { strapi: Strapi }) => Middleware | null;
|
export type MiddlewareFactory = (config: any, ctx: { strapi: Strapi }) => Middleware | null;
|
||||||
|
export type Middleware = Middleware;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user