Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/shelldandy/create-cert-files

Create self signed cert files to be used with webpack-dev-server or browsersync
https://github.com/shelldandy/create-cert-files

javascript nodejs ssl-certificates webpack

Last synced: about 2 months ago
JSON representation

Create self signed cert files to be used with webpack-dev-server or browsersync

Awesome Lists containing this project

README

        

# create-cert-files
Create self signed cert files to be used with webpack-dev-server or browsersync

## Usage with BrowserSync

```bash
npm install --dev create-cert-files browser-sync
```

```js
const fakeCert = require('create-cert-files')()
const browserSync = require('browser-sync')

browserSync.init({
https: {
key: fakeCert.key,
cert: fakeCert.cert
}
})
```

## Usage with webpack

```bash
npm install --save-dev create-cert-files
```

In your webpack.config.js
```js
const fakeCert = require('create-cert-files')(options)
const fs = require('fs')

module.exports = {
devServer: {
https: {
key: fs.readFileSync(fakeCert.key),
cert: fs.readFileSync(fakeCert.cert)
}
}
}
```

## options
### keyPath
Path of key file
### certPath
Path of cert file
### altNames
An array of subjectAltName
```js
[
{
// type 2 is DNS
type: 2,
value: 'localhost'
},
{
// type 7 is IP
type: 7,
ip: '127.0.0.1'
}
]
```

* Profit