Skip to main content

Local development server

MonsterJS CLI provides a command to start a local development server allowing us to see the changes we made in our project before making it live.

Serve command

To start the local development server we can run the following command:

mn serve

The command above will start a development server in port 4000 and will use the dev environment variables. Please see environment variables for more information about these variables.

When the server is running we can now view our project by pointing our browsers to http://localhost:4000.

Command options

OptionDescriptionValue typeDefault
--env <value>Serve the project using the specified environment.stringdev
--port <value>Set the port for the local development server.number4000
--mode <value>Serve the project in 'development', 'production', or 'none' mode. See webpack mode for more info about the different modes.stringdevelopment
--openOpens a browser when local development server is ready.booleanfalse

Example.

mn serve --port 8080