美文网首页
nodejs之 hello world

nodejs之 hello world

作者: skills | 来源:发表于2017-05-24 00:26 被阅读11次

创建一个node 'hello world'应用
我们首先要将'http'引入,
var http = require('http');
然后创建一个服务器,新建一个'server.js'
然后在里面写上,
代码如下:

var http = require('http');

http.createServer(function (request, response) {
    // 发送请求头
    response.writeHead(200, {
        'Content-Type': 'text/plain'
    });
   
    response.end('hello world\n');
});

console.log('server running at http://127.0.0.1:8080');

这样,一个很简单的``

相关文章

  • nodejs之 hello world

    创建一个node 'hello world'应用我们首先要将'http'引入,var http = require...

  • node.js入门教程

    nodejs和npm的安装 体验一下 Hello World 之 Node.js 基础之Npm使用 Node之模块...

  • nodeJs 学习笔记(1)-- 安装forever、super

    本篇文章记录从零开始学习nodeJs,那就从hello world 开始吧~ 1. hello world 首先创...

  • Node+Npm安装配置

    1. 技术目标 NodeJS下载NodeJS安装配置与WebStorm整合使用Hello World入门开源项目实...

  • vue

    知识准备 环境搭建 hello world 开发脚手架介绍 知识准备 nodejs: nodejs是一个基于Chr...

  • 常用markdown语法

    Hello World! Hello World! Hello World! Hello World! Hello...

  • hello

    hello, world hello, world hello, world hello, world

  • Markdown

    标题: hello world hello world hello world hello world hello...

  • 2018-06-11

    markdown hello world hello world hello world hello world ...

  • electron 快速入门

    从hello world开始入手,我的环境是macOs Mojave 请确保已安装nodejs electron...

网友评论

      本文标题:nodejs之 hello world

      本文链接:https://www.haomeiwen.com/subject/ytknxxtx.html