Qiita Teams that are logged in
You are not logged in to any team

Log in to Qiita Team
Community
OrganizationEventAdvent CalendarQiitadon (β)
Service
Qiita JobsQiita ZineQiita Blog
16
Help us understand the problem. What are the problem?

More than 5 years have passed since last update.

posted at

node.jsでHello World

1.Hello Worldを表示させる

下記のソースを任意のディレクトリで保存します。

ここではexample.jsという名前で作成しました。

var sys = require('sys');
var http = require('http');
var server = http.createServer(
    function (request, response) {
        response.writeHead(200, {'Content-Type': 'text/plain'});
        response.write('Hello World!!');
        response.end();
    }
).listen(3000);
sys.log('Server running at http://localhost:3000/');

2.example.jsを実行

$ node example.js
7 Aug 09:50:00 - Server running at http://localhost:3000/

3.ブラウザからアクセス

ブラウザから以下へアクセス

http://localhost:3000

Hello Worldと表示されれば成功です。

Why not register and get more from Qiita?
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away
16
Help us understand the problem. What are the problem?