Understanding server scripts
Strapi comes with a few scripts that can be used in managing the development server as well as starting the server in production. If you open the package.json
file, you will see the following four scripts:
The develop script
The develop
script will start the server in development mode, with autoreload enabled. Basically, it will watch for any changes in the project files and restart the server if there are any. This script is intended for local development, and it should never be used in a production environment.
The start script
The start
script will start the server with autoreload disabled. This script is intended to start the server in a production environment.
The build script
This script allows you to rebuild the admin panel. The Strapi admin panel is built using React.js, but in some situations, you might want to customize or extend the admin panel. In such cases, you will need to rebuild the admin panel again using the build
script. The admin panel is built once when you have created a project and every time you install a plugin that requires changes to the admin panel.
The Strapi script
This script is an alias to the Strapi command-line interface (CLI), and we can use it to generate new content in our system. We will explore the Strapi CLI in the next chapter.