NodeJS

nvm のデフォルトのバージョンを変える

nvm ls nvm alias default v??? でバージョン変更。ターミナルのセッション再起動で設定が読み込まれるはず。 再度 nvm ls でデフォルトになっているのが確認可能。 ❯ nvm ls v4.0.0 -> v7.2.1 system default -> v7.2.1 node -> stable (-> v7.2.1) (defaul…

Express & PostgreSQL & Passport

https://node-postgres.com/ GitHub - DayOnePl/dos-server: DOS is a boilerplate stack for building Node.js projects with Express & Postgres Node authentication with Passport & Postgres – Real Life Programming Node, Passport, and Postgres

NodeJS で Postgres を使う

とりあえずインストール brew install postgresql ln -sfv /usr/local/opt/postgresql/*.plist ~/Library/LaunchAgents zshrcに、 alias pg-start="brew services start postgresql" alias pg-stop="brew services stop postgresql" alias pg-restart="brew …

Raspberry Pi の node と npm のバージョンを上げる

参考からの丸コピペだけれど、毎回探していたので、記事にする。 $ sudo -i $ apt-get remove nodered -y $ apt-get remove nodejs nodejs-legacy -y $ curl -L https://git.io/n-install | bash 新しい Terminal ウィンドウを起動して、インストール終了後…

Microsoft Cognitive Services でバイナリ送る

Microsoft が提供している Microsoft Cognitive Services の Emotion API を使ってみた。 www.microsoft.com パラメータがいろいろあり、かなり遊べる感じだったものの、どの API のサンプルを見ても URL で画像を送っている。ただ普通にreadFile して送りつ…

Node でのライブラリクラスの書き方

(function(global) { "use strict"; let hoge = "", fuga = ""; class ClassName { constructor(_hoge) { this.hoge = _hoge === undefined ? false : _hoge; }; functionName () { } if ("process" in global) { module["exports"] = ClassName; }; global[…

Node のバージョンをあげる

なぜか誰も書いてない気がする系記事。 Babel 使わずにあげたいと思った時は nvm 使えばよい。 nvm on github : nvm/README.markdown at master · creationix/nvm · GitHub 例のごとくバージョンによって違うはずなので、やるときはソース元をきちんと参照し…