I want to create a custom api in strapi backend for that i generated a plugin which will help me to create a api for me ...so i created a plugin called test for testing purpose,when i try to access the test response in postman its showing 404 error is not accessible ...
i will show you the code
This is my route file..
src/plugins/test/server/routes
export default [
{
method: 'GET',
path: '/',
handler: 'myController.index',
config: {
policies: [],
auth:false
},
},
];
This is my controller file..
src/plugins/test/server/controllers/my-controller.ts
import { Strapi } from '@strapi/strapi';
export default ({ strapi }: { strapi: Strapi }) => ({
index(ctx) {
ctx.body = strapi
.plugin('test')
.service('myService')
.getWelcomeMessage();
},
});
This is my service file..
src/plugins/test/server/services/my-service.ts
import { Strapi } from '@strapi/strapi';
export default ({ strapi }: { strapi: Strapi }) => ({
getWelcomeMessage() {
return 'Welcome to Strapi ';
},
});
above code is by default generated by the strapi plugin ..when i m trying to access via endpoint http://localhost:1337/test
is not getting response back why is the issue please help me identify the issue..