# Local environment Setup

* Postman JSON for API [Link](https://razermis.sharepoint.com/:f:/s/RazerGoldKM-Engineering/Elm1CcUhDy5Bi8DnqkrfjFcBhTlxw1659hAJVTdhBxqSxw?e=8PxaYZ)

* [Engineering Doc](https://razermis.sharepoint.com/:f:/s/RazerGoldKM-Engineering/EjcLZaXu9ZhLtqeJgUQxeF8Bn2jGEe8l5UOOKiTPT8iXWQ?e=ZnCFbc)

* Visual Studio Code

  * ```json
        "configurations": [
            {
                "type": "node",
                "name": "Launch via NPM",
                "request": "launch",
                "protocol": "inspector",
                "cwd": "${workspaceRoot}",
                "runtimeExecutable": "npm",
                "runtimeArgs": [
                    "run-script", "start"
                ],
                "outputCapture": "std",
                "port": 5858    //inspector default port use to server side debug
            }]
    ```

  * 

* NodeJS

* FortiClient VPN access to connec to dev server

* Create Razer Dev Account

  * https://dweb.zgold-dev.razer.com/

* SSL cert files under `C:\etc\ssl\nodejs`

  * [`zgdwild.chain`](./ssl/zgdwild.chain)
  * [`zgdwild.key`](./ssl/zgdwild.key)
  * [`zgdwild.pem`](./ssl/zgdwild.pem)

* host file `C:\Windows\System32\drivers\etc\hosts`

  * ```text
    127.0.0.1 www.zgold-dev.razer.com
    ```

    

* Start BE server. BE server also serve FE at port 443 `./dist`

  * `npm start`

* Start FE server to proxy from `https://www.zgold-dev.razer.com:7888/api` to `https://localhost/api`

  * `npm run serve` to serve FE webpack

  * Hot Reload editing here

  * proxy setup in `webpack.dev.js`

    ```json
    devServer: {
        allowedHosts: [
          'media.zvault.razerzone.com',
          'media.gold.razer.com'
        ],
        contentBase: dist,
        publicPath: '/',
        open: true,
        progress: true,
        host: Environment.webpackHost,
        port: Environment.webpackPort,
        proxy: {
          '/api': 'https://www.zgold-dev.razer.com'
        },
        https: {
          ca: fs.readFileSync(Environment.ssl.ca, 'utf8'),
          key: fs.readFileSync(Environment.ssl.key, 'utf8'),
          cert: fs.readFileSync(Environment.ssl.cert, 'utf8'),
          spdy: {
            protocols: ['http/1.1']
          }
        },
    ```

