Once you have a MongoDB cluster running and have set up a BitScoop account, created maps for all of the services, and saved the credentials for that service in its respective Map, you have everything you need to run the API.
You'll need to create a new file in the config folder called dev.json, or whatever you'd like other than 'default.json', 'local.json', and 'production.json'. The gitignore covers 'local.json' and 'dev.json', so if you call it anything else, be sure not to add it to git.
This new config file only needs a few lines, because the 'config' library first pulls everything from 'default.json' and then overrides anything that it finds in other config files it uses. The config file should look like this:
{
"mongodb": {
"address": "<insert address>"
},
"bitscoop": {
"api_key": "<insert API key>"
}
}
Run npm install or yarn install (npm or yarn must already be installed).
NOTE: If you've already done this while setting up the app, you can skip this entire step.
You'll need to run the two migrations in the migrations folder via 'NODE_ENV=local node --experimental-modules migrations/.js' (or NODE_ENV=dev, or whatever you named your config file). You must be running Node 12 or higher for this command to work. The first migration creates indices on each collection that LifeScope stores in the database. The second loads the LifeScope Providers into the database. Make sure that you've replaced the remote_map_id's in the Providers with the BitScoop Map IDs you've created.
NOTE: If you've already done this while setting up the app, you can skip this entire step here.
You'll need to edit your hostfile to redirect traffic to *.dev.lifescope.io to your local servers. On Linux and Mac, run 'sudo gedit /etc/hosts', then add a line
127.0.0.1 api.dev.lifescope.io app.dev.lifescope.io xr.dev.lifescope.io nxr.dev.lifescope.io
Make sure to save this. It may take a few minutes for the hostfile to be recognized; rebooting your computer should guarantee it.
Next, shut down any currently-running nginx with
sudo service nginx stop
and then, when navigated to the top level of the lifescope-api directory, run
sudo nginx -p . -c nginx.conf
This will run nginx configured to redirect traffic to the four subdomains we added to the hostfile to the appropriate ports on localhost. The nginx configuration forces SSL using some self-signed certificates found in the cert/ directory. You will need to hit all of those URLs in a browser and accept the fact that they're not backed by a valid Cert Authority in order for traffic to get through.
Enter 'NODE_ENV=dev node --experimental-modules server.js' to run the server. You must be running Node 12 or higher for this setup to work.