LoginSignup
9
7

More than 5 years have passed since last update.

Node.js簡易HTTPサーバー(3行)

Last updated at Posted at 2016-03-13

コード

HTTPサーバー置きたい場所に下記を置いて実行

app.js
var app = require('connect')();
app.use(require('serve-static')(__dirname))
app.listen(3000);

 $ node app.js

確認環境

Node v0.12.7 or v4.3.2
connect@3.4.1
serve-static@1.10.2

Node.jsは公式(https://nodejs.org/en/ ) からインストーラー
その後下記ターミナルからコマンド叩いてインストール
npm install connect
npm install serve-static

9
7
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
9
7