Toggle navigation
Coder-Li-wj Blog
Home
Archive
Coder-Li-wj Blog
我把梦想卖了,换成了柴米油盐
托管静态文件
express框架————托管静态文件
导入模块 方法一: const express = require('express') const app = express() 方法二:const app = require('express')() 1 2 3 4 5 6 7 8 9 10 11 //实现静态资源服务(静态资源存放在public文件中) let server = app.use(express.static('p...
post参数处理
Node.js————post参数处理
导入系统模块:const querystring = require('querystring'); 1 2 3 4 5 6 7 8 9 10 11 12 13 const querystring = require('querystring') let param = 'foo=bar&abc=123&abc=456' //param方法将字符串转成对象 let obj ...
get参数处理
Node.js————get参数处理
导入系统模块:const url = require('url'); 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 const url = require('url') let str = 'http://www.baidu.com/abc/qqq?flag=123&keword=javascript' //parse方...
优化静态资源
Node.js————优化静态资源
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 const http = require('http') const path = require('path') const fs = require('fs') //引入映射表,根据文件后缀获取对应...
响应完整的页面信息
Node.js————响应完整的页面信息
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 const http = require('http') const path = require('path') const fs = require('fs') //封装readFile方法:根据路径读取文件的内容,...
处理请求路径的分发
Node.js————处理请求路径的分发
http.createServer()方法中回调函数的参数request和response: 1.request对象是http.IncomingMessage 类的实例对象 2.response对象是http.ServerResponse 类的实例对象 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 const http = require('ht...
初步实现服务器功能
Node.js————初步实现服务器功能
导入http系统模块:const http = require('http'); 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 const http = require('http') //创建服务器实例对象 let server = http.createServe(); //绑定请求事件 ser...
包管理工具npm的使用
Node.js————包管理工具npm的基本使用
全局安装 -g: 全局安装的包位于Node.js环境的node_modules目录下,全局安装的包一般在命令行工具cmd中使用 本地安装: 本地安装的包在当前目录下的node_modules里面,本地安装的包一般用于实际的开发工作 npm常用的命令: 安装版(如果没有指定版本号,那么安装最新版本) npm install -g 包名称(全局安装) npm install 包...
← Newer Posts
Older Posts →
分类
webpack
Node.js
JavaScript
ES6
vue
express
mongodb
其他
开发问题记录
正则表达式
版本控制工具
笔试题
网络
CSS
MarkDown
React
mysql
-->