Bootstrap API Files in Existing Plugin

System Information
  • Strapi Version: 4.3.9
  • Database: Postgres
  • Node Version: 16

Either I’m not doing something right or the expected behaviours of bootstrapping the API files during generation is not performing actions that I’m expecting.

Using the following as an example:

% yarn strapi generate
yarn run v1.22.19
$ strapi generate
? Strapi Generators content-type - Generate a content type for an API
? Content type display name Test
? Content type singular name test
? Content type plural name tests
? Please choose the model type Collection Type
? Use draft and publish? Yes
? Do you want to add attributes? Yes
? Name of attribute question
? What type of attribute string
? Do you want to add another attribute? No
? Where do you want to add this model? Add model to an existing plugin
? Which plugin is this for? foo-plugin
? Bootstrap API related files? Yes
✔  ++ /plugins/foo-plugin/server/content-types/test/schema.json
✔  +- /plugins/foo-plugin/server/content-types/test/schema.json
✔  ++ /plugins/foo-plugin/server/controllers/test.ts
✔  ++ /plugins/foo-plugin/server/services/test.ts
✔  ++ /plugins/foo-plugin/server/routes/test.ts
✨  Done in 37.71s.

I would expect the standard CRUD routes would exist for the foo-plugin test content type, or do you need to create these routes yourself?

Also, once these routes are set up, will I be able to give permissions to certain users to access those routes through the User Permissions >> Roles panel?

Thanks in advance!

1 Like

Does anyone have an answer to this?