LoginSignup
4
3

More than 5 years have passed since last update.

parcelで超絶簡単にhttpsの動作テストしてみる

Last updated at Posted at 2018-01-19

概要

以前のバージョンでparcelでhttps使えなくてなんだかなぁ・・・と思ってたんですが
今日、ちょっとやってみたら、めちゃくちゃ簡単で感動しました。

なので、ちょっと記事にしておきます。

というわけで簡単なhttpsで動作するテストを書いてみる。

OSX High sierra
node v9.4.0
使いました。

$ mkdir httpsTest
$ cd httpsTest
$ npm init
$ npm install --save parcel-bundler

index.htmlを適当に作る

index.html
<html>
  <head></head>
  <body>test</body>
</html>

package.jsonのscript:testを書き換える

package.json
{
  "name": "httpstest",
  "version": "1.0.0",
  "description": "",
  "main": "index.js",
  "scripts": {
    "test": "parcel --https index.html"
  },
  "author": "",
  "license": "ISC",
  "dependencies": {
    "parcel-bundler": "^1.4.1"
  }
}

あとは実行するだけ

$ npm test

> httpstest@1.0.0 test /Users/taktod/Documents/node/httpsTest
> parcel --https index.html

Generating SSL Certificate...
Server running at https://localhost:1234 

スクリーンショット 2018-01-19 15.12.34.png

できました。

なにこれ、証明書自動生成とかすごく助かるんですけど。

4
3
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
4
3