首页 > 编程语言 >《Node.js+Vue.js+MangoDB全栈开发实战》已出版

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

时间:2024-05-01 10:55:40浏览次数:41  
标签:Node Vue MongoDB js 7.2 模块 9.4

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

随书源码下载地址:

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

课件下载地址:

链接:https://pan.baidu.com/s/1M36y1xu-gIUidDxw38GlBg
提取码:1988

随书目录

目    录

第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,Vue,MongoDB,js,7.2,模块,9.4
From: https://www.cnblogs.com/jiekzou/p/18169091

相关文章

  • threejs 几何体的本质 顶点
    几何体的线框模式,一个正方平面最少可以由4个顶点组成,两个三角形组成(公用了2个顶点,使用了索引创建顶点属性)。//导入threejsimport*asTHREEfrom"three";import{OrbitControls}from"three/examples/jsm/controls/OrbitControls.js";//引入dat.gui.js的一个类GU......
  • threejs - js库 gui 的使用 调试开发3D效果
    //导入threejsimport*asTHREEfrom"three";import{OrbitControls}from"three/examples/jsm/controls/OrbitControls.js";//引入dat.gui.js的一个类GUIimport{GUI}from'three/addons/libs/lil-gui.module.min.js';//创建场景scene......
  • html,js代码编译,加密,代码一键打包软件,HTML转exe程序
    个人软件注意杀毒软件会报毒,,放行便可小尘web打包程序可以将整个web工程项目打包成一个exe程序运行不是打包浏览器内核应用,是代码打包软件,打包后和原来一样放在nginx类软件里运行下载地址https://download.csdn.net/download/rllmqe/88789653链接:https://pan.baidu.com/s/1HTql......
  • 使用@lakehouse-rs/flight-sql-client nodejs api 快速访问dremio 服务
    @lakehouse-rs/flight-sql-client是基于rust开发的nodearrowflightsqlclient,dremio目前也是推荐基于arrowflightsql的访问模式参考代码package.json{"name":"node-arrow-flight-sql","version":"1.0.0","ma......
  • Vue入门到关门之前端引入
    一、前端发展历史1、什么是前端?前端:针对浏览器的开发,代码在浏览器运行后端:针对服务器的开发,代码在服务器运行2、前后端不分的时代互联网发展的早期,前后端开发是一体的,前端代码是后端代码的一部分。就比如使用HTML(5)、CSS(3)、JavaScript(ES5、ES6)来编写一个个的页面,然后......
  • Vue入门到关门之计算属性与监听属性
    一、计算属性1、什么是计算属性计算属性是基于其它属性计算得出的属性,就像Python中的property,可以把方法/函数伪装成属性,在模板中可以像普通属性一样使用,但它们是基于响应式依赖进行缓存的。这意味着只有在依赖的响应式数据发生改变时,计算属性才会重新计算,否则会直接返回缓存的......
  • Vue入门到关门之生命周期钩子
    一、生命周期钩子函数1、什么是生命周期?在软件开发中,"生命周期"通常指的是一个对象从创建到销毁的整个过程。在前端开发中,特别是在使用诸如Vue.js、React等框架的情况下,"生命周期"常常指的是组件或实例在其存在期间经历的一系列阶段。在Vue.js中,每个Vue实例都有一个生命周期,它......
  • Vue入门到关门之Vue介绍与使用
    一、vue框架介绍1、什么是Vue?Vue(读音/vjuː/,类似于view)是一套用于构建用户界面的渐进式框架。与其它大型框架不同的是,Vue被设计为可以自底向上逐层应用。Vue的核心库只关注视图层,不仅易于上手,还便于与第三方库或既有项目整合。另一方面,当与现代化的工具链以及各种支持类......
  • Vue入门到关门之指令系统
    一、引入在Vue.js中,指令(Directives)是一种特殊的标记,用于向Vue实例提供特殊的行为。指令以v-开头,例如v-if、v-for等。指令的本质就是语法糖,标志位。在编译阶段render函数里,会把指令编译成JavaScript代码。注意:指令都是放在标签上的二、指令1、文本指令(1)v-text......
  • 06-混入-自定义插件-插槽-本地存储-vuex组件通信-页面跳转
    混入mixin在Vue中,混入(mixin)是一种可以在多个组件中重复使用的对象。它允许您将组件中的一些选项提取出来,然后在多个组件中进行重复使用。混入可以包含组件中的任何选项,例如数据、计算属性、方法等。使用步骤在src文件夹下新建一个文件夹,比如mixin,然后再这个文件夹下面新建一......