secure-dev-server
v0.1.2
Published
A secure development proxy that lets you route different paths to different targets and has support for valid SSL.
Downloads
6
Readme
secure-dev-server
A secure development proxy that lets you route different paths to different targets and has support for valid SSL.
Install
$ npm i secure-dev-server --save-dev
This project uses cosmiconfig for loading configuration files. You can configure your dev server in one of several ways:
- Add
.devserverrc
in the root of your project:
{
"domain": "mysite.local",
"ssl": true,
"rules": [
{
"path": "/api/*",
"target": "http://localhost:4003"
},
{
"path": "/*",
"target": "http://localhost:4200"
}
]
}
You can use JSON and YAML formats. Alternatively you can name the file .devserverrc.json
or .devserverrc.yaml
to be more explicit.
- Add
devserver
key to yourpackage.json
:
{
"devserver": {
"domain": "mysite.local",
// ...
}
}
- Add
devserver.config.js
to the root of your project and export a JavaScript object:
module.exports = {
domain: 'mysite.local',
// ...
}
Usage
After configuring the devserver
you can call it from your terminal:
$ sudo ./node_modules/.bin/secure-dev-server
or from an npm script:
{
"scripts": {
"dev": "secure-dev-server"
}
}
$ sudo npm run dev
Note that you need sudo because this script runs the host on 443
or 80
ports.
License
This software is licensed under the MIT License