《Node.js+Vue.js+MangoDB全栈开发实战》

图书购买地址:

京东:《Node.js+Vue.js+MangoDB全栈开发实战》

当当:《Node.js+Vue.js+MangoDB全栈开发实战》

天猫:《Node.js+Vue.js+MangoDB全栈开发实战》

随书源码下载地址:

链接:https://pan.baidu.com/s/1DQYgPZLmtJCIuDXs8gub_w?pwd=1127
提取码:1127

课件下载地址:

本书提供PPT课件,请联系作者或者出版社!

随书目录

目    录

第1章  Node.js和TypeScript基础·································································· 1

1.1  Node.js开发概述······································································································· 1

1.1.1  为什么要学习Node.js························································································ 1

1.1.2  什么是Node.js································································································· 2

1.1.3  Node.js特点···································································································· 3

1.1.4  var、let和const的区别······················································································ 3

1.1.5  开发工具········································································································ 4

1.2  Node运行环境搭建···································································································· 5

1.2.1  Node.js运行环境安装························································································ 5

1.2.2  Node环境安装失败解决办法··············································································· 6

1.2.3  代码有无分号的问题························································································· 6

1.3  Node.js快速入门······································································································· 7

1.3.1  Node.js的组成································································································· 7

1.3.2  Node.js基础语法······························································································ 7

1.3.3  Node.js全局对象global······················································································ 7

1.4  nvm简介、安装、使用······························································································· 8

1.5  VS Code的使用········································································································· 9

1.5.1  忽略node_module目录····················································································· 10

1.5.2  安装VS Code插件·························································································· 10

1.5.3  打开并运行项目······························································································ 12

1.5.4  VS Code配置································································································· 14

1.5.5  搜索············································································································· 15

第2章  模块加载及第三方包········································································· 17

2.1  Node.js模块化开发··································································································· 17

2.1.1  JavaScript开发弊端·························································································· 17

2.1.2  模块化·········································································································· 18

2.1.3  Node.js中模块化开发规范················································································· 18

2.1.4  exports和module.exports的区别········································································· 20

2.1.5  require优先从缓存加载····················································································· 21

2.2  系统模块················································································································ 22

2.2.1  什么是系统模块······························································································ 22

2.2.2  系统模块fs文件操作······················································································· 22

2.2.3  系统模块path路径操作···················································································· 24

2.2.4  相对路径VS绝对路径····················································································· 24

2.3  第三方模块············································································································· 25

2.3.1  什么是第三方模块··························································································· 25

2.3.2  获取第三方模块······························································································ 25

2.3.3  npm············································································································· 25

2.3.4  yarn············································································································· 26

2.3.5  yarn和npm的区别·························································································· 27

2.3.6  第三方模块nrm······························································································ 28

2.3.7  第三方模块nodemon························································································ 29

2.3.8  第三方模块 gulp····························································································· 29

2.3.9  npx·············································································································· 36

2.4  package.json文件······································································································ 37

2.4.1  node_modules目录的问题·················································································· 37

2.4.2  package.json文件的作用···················································································· 38

2.4.3  项目依赖和开发依赖························································································ 38

2.4.4  package.json文件各个选项含义··········································································· 38

2.4.5  package-lock.json文件的作用·············································································· 40

2.4.6  yarn.lock的作用······························································································ 40

2.5  Node.js中模块的加载机制·························································································· 41

2.5.1  模块查找规则:当模块拥有路径但没有后缀时······················································· 41

2.5.2  模块查找规则:当模块没有路径且没有后缀时······················································· 41

第3章  HTTP及Node异步编程···································································· 44

3.1  C/S、B/S软件体系结构分析······················································································· 44

3.2  服务器端基础概念···································································································· 45

3.2.1  网站的组成···································································································· 45

3.2.2  网站服务器···································································································· 46

3.2.3  IP地址········································································································· 46

3.2.4  域名············································································································· 47

3.2.5  端口············································································································· 48

3.2.6  URL············································································································· 49

3.2.7  客户端和服务器端··························································································· 49

3.3  创建web服务器······································································································ 49

3.4  HTTP协议·············································································································· 51

3.4.1  HTTP协议的概念··························································································· 51

3.4.2  报文············································································································· 51

3.4.3  请求报文······································································································· 52

3.4.4  响应报文······································································································· 57

3.5  HTTP请求与响应处理······························································································· 58

3.5.1  请求参数······································································································· 58

3.5.2  GET请求参数································································································ 58

3.5.3  POST请求参数······························································································ 59

3.5.4  路由············································································································· 60

3.5.5  静态资源······································································································· 61

3.5.6  动态资源······································································································· 62

3.5.7  客户端请求方式······························································································ 63

3.6  Node.js异步编程······································································································ 64

3.6.1  同步API,异步API························································································ 64

3.6.2  同步API,异步API的区别·············································································· 64

3.6.3  回调函数······································································································· 66

3.6.4  Node.js中的异步API······················································································· 66

3.6.5  Promise········································································································· 68

3.6.6  异步函数async和await···················································································· 70

第4章  MongoDB数据库············································································ 72

4.1  数据库概述············································································································· 72

4.1.1  为什么要使用数据库························································································ 72

4.1.2  什么是数据库································································································· 72

4.1.3  MongoDB数据库相关概念················································································ 73

4.2  MongoDB数据库环境搭建························································································· 75

4.2.1  MongoDB数据库下载安装················································································ 75

4.2.2  启动MongoDB······························································································· 78

4.3  MongoDB操作········································································································ 78

4.3.1  MongoDB的Shell操作···················································································· 78

4.3.2  MongoDB可视化软件······················································································ 83

4.3.3  MongoDB导入导出数据··················································································· 85

4.4  MongoDB索引介绍及数据库命令操作·········································································· 86

4.4.1  创建简单索引································································································· 86

4.4.2  唯一索引······································································································· 88

4.4.3  删除重复值···································································································· 88

4.4.4  Hint············································································································· 88

4.4.5  Expain·········································································································· 88

4.4.6  索引管理······································································································· 90

4.5  MongoDB备份与恢复······························································································· 91

4.5.1  MongoDB数据库备份······················································································ 91

4.5.2  MongoDB数据库恢复······················································································ 91

4.6  Mongoose数据库连接······························································································· 93

4.7  Mongoose增删改查操作···························································································· 93

4.7.1  创建数据库···································································································· 94

4.7.2  创建集合······································································································· 95

4.7.3  创建文档······································································································· 95

4.7.4  查询文档······································································································· 96

4.7.5  删除文档····································································································· 101

4.7.6  更新文档····································································································· 101

4.7.7  mongoose验证······························································································ 102

4.7.8  集合关联····································································································· 103

第5章  art-template模板引擎······································································ 106

5.1  模板引擎的基础概念······························································································· 106

5.1.1  模板引擎····································································································· 106

5.1.2  art-template简介····························································································· 107

5.2  模板引擎语法········································································································ 110

5.2.1  输出··········································································································· 110

5.2.2  原文输出····································································································· 110

5.2.3  条件判断····································································································· 110

5.2.4  循环··········································································································· 110

5.2.5  子模板········································································································ 111

5.2.6  模板继承····································································································· 111

5.2.7  模板配置····································································································· 112

5.3  案例——用户管理·································································································· 113

5.3.1  案例介绍····································································································· 113

5.3.2  操作步骤····································································································· 115

第6章  Express框架················································································ 125

6.1  Express框架简介···································································································· 125

6.1.1  Express框架是什么························································································ 125

6.1.2  Express框架特性··························································································· 125

6.2  中间件················································································································· 126

6.2.1  什么是中间件······························································································· 126

6.2.2  app.use中间件用法························································································ 127

6.2.3  中间件应用·································································································· 128

6.2.4  错误处理中间件···························································································· 129

6.2.5  捕获异常····································································································· 130

6.3  Express请求处理···································································································· 131

6.3.1  构建路由····································································································· 131

6.3.2  构建模块化路由···························································································· 132

6.3.3  GET参数的获取···························································································· 132

6.3.4  POST参数的获取·························································································· 133

6.3.5  Express路由参数··························································································· 134

6.3.6  静态资源处理······························································································· 135

6.4  express-art-template模板引擎······················································································ 135

6.5  express-session········································································································ 136

6.5.1  Session简单介绍··························································································· 136

6.5.2  express-session的使用····················································································· 136

6.5.3  express-session 的常用参数·············································································· 137

第7章  TypeScript介绍············································································ 138

7.1  TypeScript基础······································································································· 138

7.1.1  TypeScript简介····························································································· 138

7.1.2  TypeScript的特点·························································································· 139

7.1.3  安装TypeScript····························································································· 139

7.1.4  ts和js的区别······························································································· 140

7.1.5  编写TS程序································································································ 140

7.1.6  手动编译代码······························································································· 141

7.1.7  VS Code自动编译························································································· 142

7.1.8  类型注解····································································································· 143

7.1.9  vite快速创建ts开发环境················································································· 144

7.2  基础类型·············································································································· 145

7.2.1  布尔值········································································································ 145

7.2.2  数字··········································································································· 146

7.2.3  字符串········································································································ 146

7.2.4  undefined和null···························································································· 146

7.2.5  数组··········································································································· 147

7.2.6  元组Tuple···································································································· 147

7.2.7  枚举··········································································································· 147

7.2.8  any············································································································· 148

7.2.9  void············································································································ 148

7.2.10  Never········································································································ 149

7.2.11  Object········································································································ 149

7.2.12  联合类型···································································································· 149

7.2.13  类型断言···································································································· 150

7.2.14  类型推断···································································································· 150

7.3  接口···················································································································· 151

7.3.1  接口初探····································································································· 151

7.3.2  可选属性?···································································································· 151

7.3.3  只读属性readonly·························································································· 152

7.3.4  函数类型····································································································· 152

7.3.5  类类型········································································································ 153

7.4  类······················································································································· 154

7.4.1  基本示例····································································································· 154

7.4.2  继承··········································································································· 154

7.4.3  公共,私有与受保护的修饰符·········································································· 157

7.4.4  readonly 修饰符···························································································· 158

7.4.5  存取器········································································································ 158

7.4.6  静态属性····································································································· 159

7.4.7  抽象类········································································································ 160

7.5  函数···················································································································· 160

7.5.1  基本示例····································································································· 160

7.5.2  函数类型····································································································· 161

7.5.3  可选参数和默认参数······················································································ 161

7.5.4  剩余参数····································································································· 161

7.5.5  函数重载····································································································· 162

7.6  泛型···················································································································· 162

7.6.1  泛型引入····································································································· 163

7.6.2  使用函数泛型······························································································· 163

7.6.3  多个泛型参数的函数······················································································ 163

7.6.4  泛型接口····································································································· 163

7.6.5  泛型类········································································································ 164

7.6.6  泛型约束····································································································· 165

7.7  声明文件和内置对象······························································································· 165

7.7.1  声明文件····································································································· 165

7.7.2  内置对象····································································································· 166

第8章  文章管理系统··············································································· 168

8.1  项目环境搭建········································································································ 168

8.1.1  项目介绍····································································································· 168

8.1.2  项目框架搭建······························································································· 169

8.2  项目功能实现········································································································ 176

8.2.1  登录··········································································································· 176

8.2.2  文章管理····································································································· 191

8.2.3  用户管理····································································································· 203

8.2.4  网站首页文章展示························································································· 207

8.2.5  文章评论····································································································· 208

8.2.6  访问权限控制······························································································· 210

8.3  项目源码和运行····································································································· 211

第9章  后台管理系统··············································································· 213

9.1  项目介绍·············································································································· 213

9.1.1  项目介绍····································································································· 213

9.1.2  技术选型····································································································· 215

9.2  项目搭建·············································································································· 216

9.3  后端项目搭建········································································································ 217

9.3.1  搭建node web服务器项目··············································································· 217

9.3.2  数据库初始化······························································································· 226

9.3.3  启动web服务器···························································································· 227

9.3.4  接口测试····································································································· 227

9.4  前端项目搭建········································································································ 228

9.4.1  基础目录结构构建························································································· 228

9.4.2  配置pinia····································································································· 232

9.4.3  准备路由环境······························································································· 234

9.4.4  封装接口请求······························································································· 234

9.4.5  搭建主界面·································································································· 237

9.4.6  配置路由····································································································· 243

9.4.7  构建系统后台首页························································································· 246

9.4.8  用户列表····································································································· 248

9.4.9  新增/编辑用户······························································································ 253

9.4.10  配置代理···································································································· 258

9.5  项目运行·············································································································· 258

《Node.js+Vue.js+MangoDB全栈开发实战》已出版的更多相关文章

  1. 《Node+MongoDB+React 项目实战开发》已出版

    前言 从深圳回长沙已经快4个月了,除了把车开熟练了外,并没有什么值得一提的,长沙这边要么就是连续下一个月雨,要么就是连续一个月高温暴晒,上班更是没啥子意思,长沙这边的公司和深圳落差挺大的,薪资也是断崖 ...

  2. React项目实战:react-redux-router基本原理

    React相关 React 是一个采用声明式,高效而且灵活的用来构建用户界面的框架. JSX 本质上来讲,JSX 只是为React.createElement(component, props, .. ...

  3. python操作三大主流数据库(10)python操作mongodb数据库④mongodb新闻项目实战

    python操作mongodb数据库④mongodb新闻项目实战 参考文档:http://flask-mongoengine.readthedocs.io/en/latest/ 目录: [root@n ...

  4. Laravel 中使用 swoole 项目实战开发案例二 (后端主动分场景给界面推送消息)

    推荐阅读:Laravel 中使用 swoole 项目实战开发案例一 (建立 swoole 和前端通信)​ 需求分析 我们假设有一个需求,我在后端点击按钮 1,首页弹出 “后端触发了按钮 1”.后端点了 ...

  5. 《ASP.NET Core应用开发入门教程》与《ASP.NET Core 应用开发项目实战》正式出版

    “全书之写印,实系初稿.有时公私琐务猬集,每写一句,三搁其笔:有时兴会淋漓,走笔疾书,絮絮不休:有时意趣萧索,执笔木坐,草草而止.每写一段,自助覆阅,辄摇其首,觉有大不妥者,即贴补重书,故剪刀浆糊乃不 ...

  6. asp.net core react 项目实战(一)

    asp.net-core-react asp.net core react 简介 开发依赖环境 .NET Core SDK (reflecting any global.json): Version: ...

  7. GraphQL搭配MongoDB入门项目实战

    什么是GraphQL GraphQL 是一种面向 API 的查询语言.在互联网早期,需求都以 Web 为主,那时候数据和业务需求都不复杂,所以用 RestAPI 的方式完全可以满足需求.但是随着互联网 ...

  8. react 项目实战(九)登录与身份认证

    SPA的鉴权方式和传统的web应用不同:由于页面的渲染不再依赖服务端,与服务端的交互都通过接口来完成,而REASTful风格的接口提倡无状态(state less),通常不使用cookie和sessi ...

  9. react 项目实战(七)用户编辑与删除

    添加操作列 编辑与删除功能都是针对已存在的某一个用户执行的操作,所以在用户列表中需要再加一个“操作”列来展现[编辑]与[删除]这两个按钮. 修改/src/pages/UserList.js文件,添加方 ...

  10. react 项目实战(十)引入AntDesign组件库

    本篇带你使用 AntDesign 组件库为我们的系统换上产品级的UI! 安装组件库 在项目目录下执行:npm i antd@3.3.0 -S 或 yarn add antd 安装组件包 执行:npm ...

随机推荐

  1. [FAQ] 修改了Dockerfile 之后,运行 docker-compose up --force-recreate 时还是报之前构建时的错误?

      因为 Docker Compose 的 --force-recreate 选项只会强制重新创建容器,而不会重新构建镜像. 因此,如果你修改了Dockerfile,需要确保重新构建新的镜像. 你可以 ...

  2. dotnet 给 NuGet 包加上 Aliases 别名解决类型冲突

    有时某个相同命名空间相同名字的类型被两个不同的 NuGet 包定义了,尽管这是非常少见的事情,咱需要使用到其中的一个 NuGet 包的类型,但默认情况下将会因为类型冲突而构建不通过.本文将告诉大家如何 ...

  3. Qt Quick 工程创建

    一.简介 Qt Quick是Qt框架中的一个模块,用于创建现代.响应式的用户界面.它基于QML(Qt Meta-Object Language)语言和Qt Quick Controls库,提供了一种声 ...

  4. SQL语法之:连表查询:union all

    1.准备 两条sql查询出来的字段数必须一致 表1 字段: 数据: 表2 字段: 数据: 2.使用 1.两张表结构完全一样,查询字段顺序也一样 select ID,NAME,SEX,AGE,NAME2 ...

  5. Golang 爬虫02

    验证邮箱 目标站点: https://movie.douban.com/top250

  6. Splashtop调查显示:居家办公生产效率更高

    抱歉,本文又是个吃瓜新闻.不得不发,你懂得~ 端午节要到了,应该请大家赛龙舟,吃粽子来着. 研究表明,即使文字顺序打乱,读者都还是能毫无障碍地读懂一篇文章.或许,大家只是一目十行的看一下主要关键词就可 ...

  7. Ubuntu 启用交换分区

    前言 交换分区也称之为 swap 分区,允许系统在内存不足的情况下将内存程序写入文件,防止系统卡死失去响应的情况发生. 检查现有交换分区 首先,确认系统中是否已存在交换分区或文件.在终端中输入以下命令 ...

  8. C#.Net筑基-类型系统①基础

    C#.Net的BCL提供了丰富的类型,最基础的是值类型.引用类型,而他们的共同(隐私)祖先是 System.Object(万物之源),所以任何类型都可以转换为Object. 01.数据类型汇总 C#. ...

  9. Biwen.Settings添加对IConfiguration&IOptions的集成支持

    Biwen.Settings 是一个简易的配置项管理模块,主要的作用就是可以校验并持久化配置项,比如将自己的配置存储到数据库中,JSON文件中等 使用上也是很简单,只需要在服务中注入配置即可, 比如我 ...

  10. mybatis-puls解决多数据源事务的问题

    直接上代码: pom: <!--JTA组件核心依赖--> <dependency> <groupId>org.springframework.boot</gr ...