# Mercury-web and Apollo for Windows
### Resources
- [Install nvm for Windows](#Install-nvm-for-Windows)
- [How to run mercury-web](#How-to-run-mercury-web)
- [How to use mercury-web locally](#How-to-use-mercury-web-locally)
- [Apollo Web Shared Instructions](#Apollo-Web-Shared-Instructions)
## Install nvm for Windows
Marcus uses node.js v12, while mercury-web uses node.js v16. To install both versions and switch between them, it’s recommended to install nvm.
Please read this [guide](https://www.freecodecamp.org/news/nvm-for-windows-how-to-download-and-install-node-version-manager-in-windows-10/) for more details.
### Uninstall node.js
You can check if it installed with this command `node –v`
> If you do not have administrator rights, you can uninstall node.js via PowerShell as Admin. Use the script below:
>
> ```
> cd 'C:\ProgramData\Microsoft\Windows\Start Menu\Programs\Node.js\'
> & '.\Uninstall Node.js.lnk'
> ```
### Download nvm-setup.exe of version 1.1.9
https://github.com/coreybutler/nvm-windows/releases
### Install nvm-windows
You can check if it installed with `nvm –v`
Run PowerShell as Admin and run following:
```
nvm install 12.18.3
nvm install 16.16.0
```
### Switch to node v16 and install/update yarn:
```
nvm use 16.16.0
npm install -g yarn
```
### How to use nvm
Check list of installed node.js versions:
`nvm list`
Switch to specific node.js version:
`nvm use 12.18.3`
or
`nvm use 16.16.0`
## How to run mercury-web
### Steps to run mercury-web:
1. Switch to node.js v16
2. Rename the **.env.local.example** file to **.env.development.local**
3. In the **.env.development.local** file change the value of the **VITE_APP_MARCUS_URL** property from **https://go.dev.nextraq.com/** to **https://go.me.nextraq.com/**
4. Run command to install dependencies:
`yarn install`
5. Run command to start app for dev env:
`yarn dev`
## How to use mercury-web locally
When application has started, it will ask you to authorize. Use credentials for user that you have setup in [Marcus Admin](https://go.dev.nextraq.com/marcusadmin). It’s recommended to create your own account and user.
> Be careful about permissions! Your user and it’s account should have access to Dashcam tabs! Check that you have these permissions in your account. Otherwise, you’ll get 403!
> - Dashcam Devices
> - Dashcam Vendor Access
> - Dashcam Settings
> - Dashcam Events
> - Dashcam Health & Alarms
## Apollo Web Shared Instructions
1. Clone the **git@github.com:NexTraq/apollo-web-shared.git** repo onto your development machine.
2. Go to **$APOLLO_HOME** (\repo\apollo-web-shared)
3. Update **package.json** "devDependencies" section with "cross-env": "5.2.1" dependency
`yarn install`
4. Update **package.json** "scripts" section with cross-env command. For example:
```
"build": "cross-env vite build"
"dev": "cross-env ESLINT_DEV=true vite"
```
5. Symlink the local package in your project:
```
cd $APOLLO_HOME
yarn link
```
6. Change directory to **$MERCURY_HOME** and run:
```
yarn link @nextraq/apollo-web-shared
yarn dev
```
7. In order to verify your changes, go to https://go.me.nextraq.com:9443/
8. In the end, don’ forget to ulink local symlink to shared package and re-install your node modules and clear out symlinked version
```
yarn unlink @nextraq/apollo-web-shared
yarn install --force
```
You can find some additional information [here](https://github.com/NexTraq/apollo-web-shared/blob/main/README.md).