Certain server features requires environment variables to be set. Please read the guides below to and set the variables that apply to you.
Required to be set when using using the server. This is used as the key to encode JWT tokens for users and context. It can be set to any string.
There are a few different ways you can set environment variables.
The easiest and most flexible way is using the dotenv NPM package.
First, create a
.env file next to your server root and add your environment variables to it like so:
Then, at the top of your server file, import the
dotenv package and call the
You can also set your environment variables via the command line on Mac and Linux.
If you are using windows, you can use the cross-env package to make this work.
Simply add the env variable before your server execution script. Commonly this is done in the
package.json scripts section.
Mac and Linux: