Server: Deploy

To deploy your script to the server, you can use the "deploy" command.

Make sure you run this command from your project root:

bm server deploy


When you run this command, the Server CLI will first show you your existing configuration (the same summary from the "info" command), and ask you to confirm you're happy with this. Press enter or type Y to continue.

This will deploy your code.


Options:

--env (default to dev)

This allows you to set the environment you wish to deploy to, such as dev, test, prod, or more. See the "Using Multiple Environments" section for more details.

--force (optional)

This will deploy your project without asking for confirmation. This feature is designed to allow automatic deployments for those interested in an automated release.


What Happens Next:

Once you run the "deploy" command, your project will be zipped up and uploaded to the server. Because we're using serverless technology to run your server side APIs, the Server API will need to perform a number of steps:

  1. Upload your code to temporary storage
  2. Create the serverless infrastructure that your code will be running on
  3. Deploy your code onto the infrastructure
  4. Create and link the HTTP endpoints that will allow you to access your code


This will take a little longer the first time you run this command, and it will then be quicker the subsequent times thereafter.


Accessing Your Sever API:

Once your deployment is complete, the Server CLI will display the URL (origin) that you can use to access your script.

For example:

https://company-project-dev.api.blinkm.io


Using Multiple Environments (Dev, Test, Prod, etc.): 

This service allows you to create and deploy to multiple environments for your project, using the "env" option.

Environments are specified in the API URL as a dash followed by the environment name.

For example, by default, the dev environment is used:

https://company-project-dev.api.blinkm.io


If, however, you were to set "--env test" option, your API URL would be:

https://company-project-test.api.blinkm.io


You can set any custom environment name here. For example, "--env mycustomenvironment" would produce the API URL:

https://company-project-mycustomenvironment.api.blinkm.io


Production URLs:

While any environment name can be used, "prod" is treated a little differently. Production URLs don't use the environment dash; instead it will produce as a shorter, cleaner API URL.

So in this case, "--env prod" will produce the API URL:

https://company-project.api.blinkm.io


Next:

Server CLI Examples and Tips

  Â