11
14

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

【10分】Node.js + ExpressでHello World for Windows

Posted at

Node.js + ExpressでHello World的なのを試してみます。

環境

  • Node.js(v8.10.0)
  • Express(v4.16.0)

Node.jsのインストール

下記公式サイトからインストーラをダウンロードし、インストールします。
(インストーラは特別難しいことないので、割愛します。)
https://nodejs.org/en/

下記コマンドでバージョンが表示されればOKです。

$ node -v

npmも一緒にダウンロードされるはずです。
下記コマンドで確認します。

$ npm -v

node-v.png

Expressのインストール

$ npm init
$ npm install express --save

アプリケーション作成

なんと初期設定はこれだけで、アプリを開発する環境が整います。
では、早速Expressでアプリを作成していきます。

$ express nodewebapp

自動的にExpressアプリが作成されます。

次に、作成したアプリのフォルダ直下に入り、必要なライブラリ等をインストールします。

$ cd nodewebapp
$ npm install

ここまででサンプルページが開けるはず!なので、一度起動してみます。

$ npm start

ブラウザで http://localhost:3000/ にアクセスし動作を確認します。

expresshelloworld.png

参考情報

11
14
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
11
14

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?