LoginSignup
12
12

More than 5 years have passed since last update.

node.js + Express 3分でゼロからアプリケーション構築

Last updated at Posted at 2016-08-15

node.js とフレークワークexpressの開発環境/アプリケーション の構築手順はいろいろあると思いますが、コマンドベースでシンプルにまとめてみました。

NVM (Node Version Manager)のインストール

git clone https://github.com/creationix/nvm.git ~/.nvm
source ~/.nvm/nvm.sh

Nodeの安定版のインストール(偶数が安定板で 奇数が開発版)

nvm install 0.12.7
node -v

ターミナル起動時に反映されるように

nvm alias default v0.12.7
echo 'if [[ -s ~/.nvm/nvm.sh ]];' >> ~/.bash_profile
echo '  then source ~/.nvm/nvm.sh' >> ~/.bash_profile
echo 'fi' >> ~/.bash_profile

アプリケーションのディレクトリ作成

mkdir my_node_app
cd my_node_app

ディレクトリ直下でexpress ジェネレータ導入

npm install express-generator -g

express ジェネレータ実行

express .

依存関係インストール

npm install

アプリケーションスタート

npm start

アクセス

http://localhost:3000
12
12
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
12
12