node.js 初体验
来源:互联网 发布:手机淘宝举报售假 编辑:程序博客网 时间:2024/05/09 14:19
用node编写一个web服务器
const http = require('http');const hostname = '127.0.0.1';const port = 3000;const server = http.createServer((req, res) => { res.statusCode = 200; res.setHeader('Content-Type', 'text/plain'); res.end('Hello World\n');});server.listen(port, hostname, () => { console.log(`服务器运行在 http://${hostname}:${port}/`);});
保存为hellonode.js,命令行运行
$ node hellonode.js服务器运行在 http://127.0.0.1:3000/
阅读全文
0 0
- node.js 初体验
- Node.js 初体验
- Node.js 初体验
- Node.js初体验
- node.js 初体验
- node.js 初体验
- node.js 初体验
- node.js 初体验
- NODE.JS初体验
- node.js 初体验
- node.js 初体验
- node.js 初体验
- node.js 初体验
- Node.js初体验
- node.js 初体验
- node.js 初体验
- Node js 初体验
- node.js 初体验
- 田忌赛马优化版
- multicast (组播)
- docker启动失败,报docker dead but pid file exists,处理方式
- 判断数组是否为空
- shell脚本之基本运算符
- node.js 初体验
- linux 的 free 内存命令详解
- 数据挖掘中SAS、python、R、spark、hadoop个人见解
- 乐观锁与悲观锁使用
- SQL Server数据库还原以及常见错误
- 数据结构实验之图论一:基于邻接矩阵的广度优先搜索遍历
- 如何让程序在锁屏后还一直运行
- 知道这20个正则表达式,能让你少写1,000行代码
- 【stm32f0】 stm32f0中中断名和中断处理函数名所在位置