When I restart strapi
, I can no longer edit content, receiving this alert:
The autoreload feature is required to use this plugin.
Start your server with strapi develop
To solve the right problem, I'd need more detail, however, I was running into the same issue while using yarn start
. Instead, I used yarn strapi dev
, which ran strapi
with the correct configuration.
I am able to run the server and edit content; however, I initially tried changing the production and staging server.json
files to include the following, but this did not work.
"autoReload": {
"enabled": true
},
I had same issue. I fixed it by running npx strapi dev
.
In the development process of your project, in order to customize (add/remove/modify) content of your API, you need to start the server in a dev mode, which is done through npx strapi dev. There is a whole command line manual on here.
When I started using Strapi, I believed that I could create/edit/delete content types in production. BUT THIS IS NOT POSSIBLE.
Notes from Strapi:
### Why can't I create or update content-types in production/staging?
Strapi stores model configuration files (what defines the model schema) in files such as `api/restaurant/models/restaurant.settings.json`. Due to how Node.js works, in order for changes to take effect, that would require Node to restart the server. This could potentionally cause downtime of your production service and likewise these changes should be tracked in some kind of source control.
Generally your "flow" of development would follow the following path:
- Development - Develop your Strapi application locally on your host machine, then push changes into source control
- Staging - Deploy changes from source control to a "production-like" environment for testing
- Production - If no other changes are needed, deploy into production
- Repeat as needed, it is recommended that you properly version and test your application as you go
At this time and in the future there is no plan to allow model creating or updating while in a production environment, and there is currently no plans to move model settings into the database. There is no known nor recommended workarounds for this.
What Should I do
You need to create schema locally in development mode npm run develop
.
Then you have to commit the repo (which will have schema under src/api
folder) to Git repo. In your production, you have to pull the repo and run it as
NODE_ENV=production npm run start