Initial Strapi plugin project
This commit is contained in:
7
server/src/bootstrap.ts
Normal file
7
server/src/bootstrap.ts
Normal file
@@ -0,0 +1,7 @@
|
||||
import type { Core } from '@strapi/strapi';
|
||||
|
||||
const bootstrap = ({ strapi }: { strapi: Core.Strapi }) => {
|
||||
// bootstrap phase
|
||||
};
|
||||
|
||||
export default bootstrap;
|
||||
4
server/src/config/index.ts
Normal file
4
server/src/config/index.ts
Normal file
@@ -0,0 +1,4 @@
|
||||
export default {
|
||||
default: {},
|
||||
validator() {},
|
||||
};
|
||||
1
server/src/content-types/index.ts
Normal file
1
server/src/content-types/index.ts
Normal file
@@ -0,0 +1 @@
|
||||
export default {};
|
||||
13
server/src/controllers/controller.ts
Normal file
13
server/src/controllers/controller.ts
Normal file
@@ -0,0 +1,13 @@
|
||||
import type { Core } from '@strapi/strapi';
|
||||
|
||||
const controller = ({ strapi }: { strapi: Core.Strapi }) => ({
|
||||
index(ctx) {
|
||||
ctx.body = strapi
|
||||
.plugin('strapi-plugin-checkbox-list')
|
||||
// the name of the service file & the method.
|
||||
.service('service')
|
||||
.getWelcomeMessage();
|
||||
},
|
||||
});
|
||||
|
||||
export default controller;
|
||||
5
server/src/controllers/index.ts
Normal file
5
server/src/controllers/index.ts
Normal file
@@ -0,0 +1,5 @@
|
||||
import controller from './controller';
|
||||
|
||||
export default {
|
||||
controller,
|
||||
};
|
||||
7
server/src/destroy.ts
Normal file
7
server/src/destroy.ts
Normal file
@@ -0,0 +1,7 @@
|
||||
import type { Core } from '@strapi/strapi';
|
||||
|
||||
const destroy = ({ strapi }: { strapi: Core.Strapi }) => {
|
||||
// destroy phase
|
||||
};
|
||||
|
||||
export default destroy;
|
||||
30
server/src/index.ts
Normal file
30
server/src/index.ts
Normal file
@@ -0,0 +1,30 @@
|
||||
/**
|
||||
* Application methods
|
||||
*/
|
||||
import bootstrap from './bootstrap';
|
||||
import destroy from './destroy';
|
||||
import register from './register';
|
||||
|
||||
/**
|
||||
* Plugin server methods
|
||||
*/
|
||||
import config from './config';
|
||||
import contentTypes from './content-types';
|
||||
import controllers from './controllers';
|
||||
import middlewares from './middlewares';
|
||||
import policies from './policies';
|
||||
import routes from './routes';
|
||||
import services from './services';
|
||||
|
||||
export default {
|
||||
register,
|
||||
bootstrap,
|
||||
destroy,
|
||||
config,
|
||||
controllers,
|
||||
routes,
|
||||
services,
|
||||
contentTypes,
|
||||
policies,
|
||||
middlewares,
|
||||
};
|
||||
1
server/src/middlewares/index.ts
Normal file
1
server/src/middlewares/index.ts
Normal file
@@ -0,0 +1 @@
|
||||
export default {};
|
||||
1
server/src/policies/index.ts
Normal file
1
server/src/policies/index.ts
Normal file
@@ -0,0 +1 @@
|
||||
export default {};
|
||||
7
server/src/register.ts
Normal file
7
server/src/register.ts
Normal file
@@ -0,0 +1,7 @@
|
||||
import type { Core } from '@strapi/strapi';
|
||||
|
||||
const register = ({ strapi }: { strapi: Core.Strapi }) => {
|
||||
// register phase
|
||||
};
|
||||
|
||||
export default register;
|
||||
4
server/src/routes/admin/index.ts
Normal file
4
server/src/routes/admin/index.ts
Normal file
@@ -0,0 +1,4 @@
|
||||
export default () => ({
|
||||
type: 'admin',
|
||||
routes: [],
|
||||
});
|
||||
14
server/src/routes/content-api/index.ts
Normal file
14
server/src/routes/content-api/index.ts
Normal file
@@ -0,0 +1,14 @@
|
||||
export default () => ({
|
||||
type: 'content-api',
|
||||
routes: [
|
||||
{
|
||||
method: 'GET',
|
||||
path: '/',
|
||||
// name of the controller file & the method.
|
||||
handler: 'controller.index',
|
||||
config: {
|
||||
policies: [],
|
||||
},
|
||||
},
|
||||
],
|
||||
});
|
||||
9
server/src/routes/index.ts
Normal file
9
server/src/routes/index.ts
Normal file
@@ -0,0 +1,9 @@
|
||||
import contentAPIRoutes from './content-api';
|
||||
import adminAPIRoutes from './admin';
|
||||
|
||||
const routes = {
|
||||
'content-api': contentAPIRoutes,
|
||||
admin: adminAPIRoutes,
|
||||
};
|
||||
|
||||
export default routes;
|
||||
5
server/src/services/index.ts
Normal file
5
server/src/services/index.ts
Normal file
@@ -0,0 +1,5 @@
|
||||
import service from './service';
|
||||
|
||||
export default {
|
||||
service,
|
||||
};
|
||||
9
server/src/services/service.ts
Normal file
9
server/src/services/service.ts
Normal file
@@ -0,0 +1,9 @@
|
||||
import type { Core } from '@strapi/strapi';
|
||||
|
||||
const service = ({ strapi }: { strapi: Core.Strapi }) => ({
|
||||
getWelcomeMessage() {
|
||||
return 'Welcome to Strapi 🚀';
|
||||
},
|
||||
});
|
||||
|
||||
export default service;
|
||||
10
server/tsconfig.build.json
Normal file
10
server/tsconfig.build.json
Normal file
@@ -0,0 +1,10 @@
|
||||
{
|
||||
"extends": "./tsconfig",
|
||||
"include": ["./src"],
|
||||
"exclude": ["**/*.test.ts"],
|
||||
"compilerOptions": {
|
||||
"rootDir": "../",
|
||||
"baseUrl": ".",
|
||||
"outDir": "./dist"
|
||||
}
|
||||
}
|
||||
8
server/tsconfig.json
Normal file
8
server/tsconfig.json
Normal file
@@ -0,0 +1,8 @@
|
||||
{
|
||||
"extends": "@strapi/typescript-utils/tsconfigs/server",
|
||||
"include": ["./src"],
|
||||
"compilerOptions": {
|
||||
"rootDir": "../",
|
||||
"baseUrl": "."
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user