码迷,mamicode.com
首页 > Web开发 > 详细

node start - hello world http server

时间:2016-07-09 13:34:10      阅读:177      评论:0      收藏:0      [点我收藏+]

标签:

Write a file t1.js

‘use strict‘;

const express = require(‘express‘);

// Constants
const PORT = 8080;

// App
const app = express();
app.get(‘/‘, function (req, res) {
  res.send(‘Hello world\n‘);
});

app.listen(PORT);
console.log(‘Running on http://localhost:‘ + PORT);

 

运行

node t1.js

 

在浏览器输入

http://localhost:8080/

 

node start - hello world http server

标签:

原文地址:http://www.cnblogs.com/cutepig/p/5655606.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!