摘要: -- 安装mysql模块 npm i mysql -连接数据库 const mysql = require('mysql') //建立与mysql数据库的连接关系 const db = mysql.createPool({ host:'127.0.0.1',//数据库的ip地址 user:'root 阅读全文
posted @ 2022-02-23 14:17 初生土豆 阅读(149) 评论(0) 推荐(0) 编辑
摘要: -中间件概念 -中间件特指业务流程的中间处理环节 -express中间件的格式 //中间件的形参列表中,必须包含next参数,而路由处理函数中只包含req和res app.get('/',(req,res,next)=>{ next() }) -next函数的作用 next函数是实现多个中间件连续调 阅读全文
posted @ 2022-02-18 16:46 初生土豆 阅读(40) 评论(0) 推荐(0) 编辑
摘要: -路由的概念 -express中的路由 在express中,路由指的是客户端请求与服务器处理函数之间的映射关系。 express中的路由由3部分组成,分别是请求的类型,请求的URL地址,处理函数,格式如下: //匹配get请求,路径为/index app.get('/index',(req,res) 阅读全文
posted @ 2022-02-18 15:43 初生土豆 阅读(196) 评论(0) 推荐(0) 编辑
摘要: -express的基本使用 -下载express npm install express --save -调用 const express = require('express') const app = express() app.listen(80,()=>{ console.log('serv 阅读全文
posted @ 2022-02-18 15:11 初生土豆 阅读(58) 评论(0) 推荐(0) 编辑
摘要: 1.引入http模块 const http = require('http') 2.调用createServer()创建服务器 const server = http.createServer() 3.调用on绑定request事件 server.on('request',()=>{ console 阅读全文
posted @ 2022-02-16 16:29 初生土豆 阅读(336) 评论(0) 推荐(0) 编辑
摘要: -path.join() -作用:把多个路径片段拼接成完整的字符串 -代码示例: const path = require('path') const fs = require('fs') // ../会抵消掉前面路径 const url = path.join('/a','/b','/ab/c', 阅读全文
posted @ 2022-02-16 15:27 初生土豆 阅读(98) 评论(0) 推荐(0) 编辑
摘要: -fs.readFile() -用来读取指定文件的内容 -语法:fs.readFile(path,options,callback) -path:必选参数,要读取的文件路径 -options:可选参数,以什么编码格式来读取文件 -callback:必选参数,读取文件后,通过回调函数拿到读取的结果 - 阅读全文
posted @ 2022-02-16 14:34 初生土豆 阅读(360) 评论(0) 推荐(0) 编辑
摘要: 1.全局API的转移 2.x全局api(Vue) 3.x全局api(app) Vue.config.xxx app.config.xxx Vue.config.productionTip 移除 Vue.component app.component Vue.directive app.directi 阅读全文
posted @ 2021-12-22 16:13 初生土豆 阅读(88) 评论(0) 推荐(0) 编辑
摘要: 1.作用:suspense在等待异步组件时额外渲染一些内容,使用户拥有更好的体验。 2.使用: 引入异步组件,Child需要在components里注册 import {defineAsyncComponent} from 'vue' // import demo from './component 阅读全文
posted @ 2021-12-22 15:34 初生土豆 阅读(2718) 评论(0) 推荐(0) 编辑
摘要: <template> <!-- vue3中模版结构可以没有根标签 --> <div class="father"> <div class="child"> <teleport to='body'> <input type="text" v-model="keyword"> <h3>{{keyword 阅读全文
posted @ 2021-12-21 16:52 初生土豆 阅读(261) 评论(0) 推荐(0) 编辑