Frontend Dev HTTPS proxy
In order to get started with this proxy, install it using yarn add --dev @dmgincs/dev-proxy.
Then, create a config file in the root of the project named dev-proxy.yml and add the following contents:
``yml`
certfolder: ./internals/cert/
containers:
- name: mainsite
env: testing
port: 3001
#### Creating the certificate files
After that, you will have to generate a ssl certificate for this proxy.
For this, you will first need to install mkcert. After this is install, run the following command in the root of the project:
`sh`
$ mkcert -cert-file .\internals\cert\cert.crt -key-file .\internals\cert\cert.key local.dmginc.gg local.testing.dmginc.gg
This will generate two cert files in ./internals/cert. These certificates are read by the proxy.
#### Host file
Then, you will have to add a namespace map to your hosts file:
``
127.0.0.1 local.dmginc.gg
127.0.0.1 local.testing.dmginc.gg/etc/hosts
You can find your hostfile in: - Linux/OSX: - Windows: C:\Windows\System32\Drivers\etc\hosts
#### Running the proxy server
In order to run the proxy server, you will have to create a file in your project. Then, put the following contents in the file:
import '@dmgincs/dev-proxy'
In order to run the file, you can use something like ts-node.
#### Running multiple frontend clients
When you want to run multiple frontend clients at the same time, you can generate the certificate files from this folder:
`sh`
$ mkcert -cert-file .\internals\cert\cert.crt -key-file .\internals\cert\cert.key local.dmginc.gg mdr.local.dmginc.gg emt.local.dmginc.gg ms.local.dmginc.gg api.local.dmginc.gg local.testing.dmginc.gg mdr.local.testing.dmginc.gg emt.local.testing.dmginc.gg ms.local.testing.dmginc.gg api.local.testing.dmginc.gg
Then, update the hosts file to contain:
```
127.0.0.1 local.dmginc.gg mdr.local.dmginc.gg emt.local.dmginc.gg ms.local.dmginc.gg api.local.dmginc.gg
127.0.0.1 local.testing.dmginc.gg mdr.local.testing.dmginc.gg emt.local.testing.dmginc.gg ms.local.testing.dmginc.gg api.local.testing.dmginc.gg