Tags: golang
0
4 notes
Tags: nodejs
0

Node.js: CGI を通して利用する

h2o の CGI として node.js のスクリプトを動かしてみた。macOS の場合、#!/usr/bin/env node がエラーになった。

#!/usr/local/bin/node
console.log('Content-type: text/plain; charset=utf-8');
console.log('');
console.log('Hello World');

サーバーにインストールされているバージョンを調べるには次の行を追加する。

console.log('Version: ' + process.version);
Tags: golang h2o
0

Golang: CGI を利用する

ふと h2o で Go の CGI を試したくなったので書いてみた。

package main
import "fmt"
func main() {
 fmt.Print("Content-type: text/plain; charset=utf-8\n\n")
 fmt.Println("Hello World!")
}

h2o の設定は次のとおり。

file.custom-handler:
 extension: .cgi
 fastcgi.spawn:
 command: "exec /usr/local/share/h2o/fastcgi-cgi"
listen:
 port: 8080
 ssl:
 certificate-file: /usr/local/etc/ssl/server.crt
 key-file: /usr/local/etc/ssl/server.key
hosts:
 "127.0.0.1.xip.io:8080":
 paths:
 /:
 file.dir: /Users/masakielastic/public_html
Tags: node.js browserify
0
1 note

Node.js: browserify の復習

browserify の復習。ES2015 とそれ以降の標準をまとめて導入できる babel-preset-env、 コードを圧縮してくれるbabel-preset-babili を一緒に導入する。

yarn add --dev browserify babelify watchify
yarn add --dev babel-preset-env babel-preset-babili

トランスパイルの実行は次のとおり。

browserify app.js -o bundle.js -t [ babelify --presets [ env babili ] ]

watchify による監視は次のとおり。

watchify -v -d app.js -o bundle.js -t [ babelify --presets [ env babili ] ]
Tags: react
0
Archive Random Home Next page Page 1 of 493

About

portrait

twitter のアカウントは sarabandejp と masakielastic (仕事関係)です。連絡先は masakielastic @gmail.com です。

People I follow

[フレーム]

AltStyle によって変換されたページ (->オリジナル) /