Skip to content

Commit

Permalink
fix: update the route syntax for it to be properly registered (#72)
Browse files Browse the repository at this point in the history
* fix: update the route syntax for it to be properly registered

* chore: add changeset

* fix: remove auth false

Signed-off-by: Boaz Poolman <[email protected]>

---------

Signed-off-by: Boaz Poolman <[email protected]>
  • Loading branch information
boazpoolman authored Feb 11, 2025
1 parent 0821835 commit 9747836
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 2 deletions.
5 changes: 5 additions & 0 deletions .changeset/angry-kings-shout.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@strapi/sdk-plugin': patch
---

Fix the routes config for it to be properly registered
34 changes: 32 additions & 2 deletions src/cli/commands/plugin/init/files/server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ const TYPESCRIPT = (pluginName: string): TemplateFile[] => [
`,
},
{
name: 'server/src/routes/index.ts',
name: 'server/src/routes/content-api.ts',
contents: outdent`
export default [
{
Expand All @@ -145,6 +145,21 @@ const TYPESCRIPT = (pluginName: string): TemplateFile[] => [
];
`,
},
{
name: 'server/src/routes/index.ts',
contents: outdent`
import contentAPIRoutes from './content-api';
const routes = {
'content-api': {
type: 'content-api',
routes: contentAPIRoutes,
},
};
export default routes;
`,
},
{
name: 'server/src/services/index.ts',
contents: outdent`
Expand Down Expand Up @@ -292,7 +307,7 @@ const JAVASCRIPT = (pluginName: string): TemplateFile[] => [
`,
},
{
name: 'server/src/routes/index.js',
name: 'server/src/routes/content-api.js',
contents: outdent`
export default [
{
Expand All @@ -307,6 +322,21 @@ const JAVASCRIPT = (pluginName: string): TemplateFile[] => [
];
`,
},
{
name: 'server/src/routes/index.js',
contents: outdent`
import contentAPIRoutes from './content-api';
const routes = {
'content-api': {
type: 'content-api',
routes: contentAPIRoutes,
},
};
export default routes;
`,
},
{
name: 'server/src/services/index.js',
contents: outdent`
Expand Down

0 comments on commit 9747836

Please sign in to comment.