-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit f8f7d01
Showing
1,996 changed files
with
445,757 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
文档(api) | ||
|
||
中文 英文 | ||
|
||
node 后端技术 两周 | ||
|
||
node+express+koa +mongodb (数据库)+mongoose | ||
|
||
vue 两周 | ||
|
||
vue全家桶 | ||
|
||
vue+vue-router+axios+vuex | ||
|
||
微信小程序 一周 基础+项目 | ||
|
||
mpvue (美团) taro(京东) react | ||
|
||
react 一周 基础+项目 | ||
|
||
|
||
|
||
选修 | ||
|
||
web安全 | ||
|
||
flutter app | ||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
node | ||
|
||
node是什么? | ||
|
||
定义: | ||
|
||
node是一个基于v8引擎的javascript运行环境 | ||
|
||
v8引擎 高性能的服务器 | ||
|
||
javascript | ||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,78 @@ | ||
回顾: | ||
|
||
node | ||
|
||
什么是node? | ||
|
||
node是一个让javascript运行在服务端的一个平台 | ||
|
||
node的特点? | ||
|
||
单线程 非阻塞I/O 事件驱动(事件循环) | ||
|
||
老3p php asp jsp 8g 4000 node 8g 40000 | ||
|
||
node是单线程 但是并发性强 高性能 =》 非阻塞I/O 事件驱动 | ||
|
||
创建一个服务器 | ||
|
||
http模块 | ||
|
||
形参和实参 | ||
|
||
形参:通过一个变量接收具有实际意义的值 (可更改) | ||
|
||
实参:具有实际意义的值 (不可更改) | ||
|
||
createServer(calllback) callback(请求requset,响应response){ 执行体} | ||
|
||
发起http | ||
|
||
结束响应 res.end() 参数为字符串类型 | ||
|
||
解决乱码: | ||
|
||
res.writeHead(200,{"Content-Type:text/html;charset=UTF8"}) | ||
|
||
text/palin 文本 | ||
|
||
text/css css | ||
|
||
image/png tupian | ||
|
||
listen () 监听端口 两个 一个为端口 第二个为回调函数 | ||
|
||
1.速度 | ||
|
||
2.代码的拼写 | ||
|
||
3.不用提示 | ||
|
||
req:url 请求的路径 | ||
|
||
url模块 | ||
|
||
parse 解析 :1.字符串 2.对象 需要多传入一个参数 true | ||
|
||
query 接收get请求发送过来的值 | ||
|
||
resolve 解析路径 两个参数 后一个参数拼接在域名上 | ||
|
||
format 把对象转化为字符串 | ||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,128 @@ | ||
回顾: | ||
|
||
fs | ||
|
||
文件 file | ||
|
||
{"flag":"a"} | ||
|
||
a: append | ||
|
||
r : read | ||
|
||
w: write | ||
|
||
目录 dir | ||
|
||
mkdir | ||
|
||
rmdir | ||
|
||
rename | ||
|
||
stat 判断文件的状态 stats isFile() isDirectory() | ||
|
||
暴露: | ||
|
||
module.exports | ||
|
||
exports | ||
|
||
作用: | ||
|
||
把一个文件抛出,从而使得可以让另一文件使用 | ||
|
||
抛出: | ||
|
||
module.exports | ||
|
||
exports | ||
|
||
使用: | ||
|
||
require() | ||
|
||
module.exports 和exports和export 和export default require import | ||
|
||
node采用的是模块机制 有多个模块拼接而成 common.js 模块化机制 | ||
|
||
node:module.exports 和exports require | ||
|
||
es6:export 和export default import | ||
|
||
module.exports和 exports的区别? | ||
|
||
exports是module.exports的引用(值) | ||
|
||
exports和module.exports相等 | ||
|
||
module.exports和exports都是一个空对象,占用同一块内存 | ||
|
||
eg: | ||
|
||
module.exports.a=2 | ||
|
||
exports.a=1 | ||
|
||
module包含exports | ||
|
||
|
||
|
||
node能做什么? | ||
|
||
node可以不单独使用 中间件 | ||
|
||
path | ||
|
||
querystring | ||
|
||
npm 国外 缺点:下载的慢 | ||
|
||
npm 包管理工具 jquery bootstrap | ||
|
||
npm init 项目初始化 package.json | ||
|
||
npm init -y | ||
|
||
下载包文件 | ||
|
||
npm install silly-datetime --save-dev | ||
|
||
install 安装依赖 | ||
|
||
silly-datetime 下载的包 | ||
|
||
--save = -S 下载到生产环境中 | ||
|
||
--save-dev =-D 下载到开发环境中 | ||
|
||
cnpm 淘宝镜像 缺点 :会造成丢失文件 | ||
|
||
npm install -g cnpm --registry=https://registry.npm.taobao.org | ||
|
||
|
||
|
||
npm 包管理工具 nvm node版本的管理工具 | ||
|
||
nrm 镜像源管理工具 | ||
|
||
npm install nrm -g | ||
|
||
nrm ls 显示镜像源列表 | ||
|
||
nrm use 包文件 切换镜像源 | ||
|
||
nrm --help(-help) 帮助文档 | ||
|
||
npm cache clean -f (--force) 清除npm缓存 | ||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
模板引擎 | ||
ejs art-template jade 代码不友好 =》pug swig | ||
什么是模板引擎? | ||
页面数据分离(把从后端读取到的数据和文件映射在html页面上) | ||
生成最终的视图文档 | ||
ejs =》模板引擎 | ||
特性:高效(速度快) | ||
1.快速编译(compiler)和输出<%=%> | ||
2.简洁的模板标签 <%%> | ||
3.引入模板片段 include 包含 | ||
4.同时支持服务器端(node)和浏览器环境 (brower) | ||
5.兼容express视图系统 | ||
使用: | ||
包管理器 npm cnpm nrm | ||
下载环境: | ||
生产环境 production dependence --save -S | ||
开发环境 dev prodction devdependence --save-dev -D | ||
什么时候把包应该下在生产环境中? | ||
|
||
初始化 | ||
npm init 自定义 | ||
npm init -y 默认 | ||
|
||
npm install ejs --save | ||
art-template | ||
npm install art-template --save | ||
文件后缀 .art | ||
传统语法 | ||
<%%> | ||
标准语法 | ||
{{}} 插值表达式 | ||
作业: | ||
foreach map filter 的区别? | ||
ejs include如何使用? | ||
res.end和res.send的区别 | ||
|
||
node模块 包 下载 模板引擎 下载 | ||
|
||
postman | ||
|
||
express | ||
npm install express --save |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
文档 api | ||
express 框架 | ||
简介: | ||
基于node封装的上层服务框架,提供简便的Api和功能方法,主要内容有路由、中间 | ||
件 同时提供了更多的http工具,使得动态渲染视图更加方便 | ||
|
||
|
||
npm install express --save | ||
|
||
npm install body-parser --save |
Oops, something went wrong.