上一页 1 ··· 14 15 16 17 18 19 20 21 22 ··· 34 下一页
  2021年6月9日
摘要: /** * 使用node连接mysql模块 */ //引入MySQL数据库 const mysql = require("mysql"); //创建一个mysql连接对象,连接是使用对象来连接数据库 let connection = mysql.createConnection({ host:"12 阅读全文
posted @ 2021-06-09 20:44 谢晨锋 阅读(514) 评论(0) 推荐(0)
摘要: 创建 index.ejs <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta http-equiv="X-UA-Compatible" content="IE=edge"> <meta name="viewport 阅读全文
posted @ 2021-06-09 20:22 谢晨锋 阅读(274) 评论(0) 推荐(0)
摘要: 图片请求案例 web页面如下 <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta http-equiv="X-UA-Compatible" content="IE=edge"> <meta name="viewpo 阅读全文
posted @ 2021-06-09 20:12 谢晨锋 阅读(120) 评论(0) 推荐(0)
摘要: ejs 页面 作用,可以在页面当中编写 js 代码 页面中 页面的名称不是 html 后缀,而是 ejs 后缀 比如: <%- errData %> node中 需要安装 ejs npm i ejs 在node当中引入 ejs //引入ejs app.set("view engine","ejs") 阅读全文
posted @ 2021-06-09 19:45 谢晨锋 阅读(1064) 评论(0) 推荐(0)
摘要: 文件夹目录 连接数据库 const mongoose = require("mongoose"); mongoose.connect("mongodb://localhost:27017/school",{ useNewUrlParser: true, useUnifiedTopology: tru 阅读全文
posted @ 2021-06-09 19:39 谢晨锋 阅读(404) 评论(0) 推荐(0)
  2021年6月8日
摘要: 文件结构 一.使用mongoose连接MongoDB数据库 //引入mongoose数据库 const mongoose = require("mongoose"); //连接mongodb数据库 mongoose.connect("mongodb://localhost:27017/school" 阅读全文
posted @ 2021-06-08 20:57 谢晨锋 阅读(152) 评论(0) 推荐(0)
摘要: 应用中间件 /** * 应用中间件 * 1.应用中间件的作用一般用于对url的拦截 * 2.应用需要使用next对象中间件放行 * * 拓展:所有的中间件都使用了use,路由器也属于中间件的一种 */ const express = require("express"); const app = e 阅读全文
posted @ 2021-06-08 19:58 谢晨锋 阅读(224) 评论(0) 推荐(0)
摘要: 搭建用户路由器 概述,路由器的作用是将功能分类,比如将user下的所有功能,都放入user路由器下 举两个例子 用户路由器 localhost:8080/user/list /** * 请求的入口 */ const express = require("express"); const app = 阅读全文
posted @ 2021-06-08 19:36 谢晨锋 阅读(89) 评论(0) 推荐(1)
摘要: 方式一:通过绑定数据流data事件来获取 <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta http-equiv="X-UA-Compatible" content="IE=edge"> <meta name=" 阅读全文
posted @ 2021-06-08 18:50 谢晨锋 阅读(1566) 评论(0) 推荐(0)
摘要: const express = require("express"); const app = express(); app.listen(8080); /** * 请求方式一 * http://localhost:8080/reg?username=zhangsan&password=123456 阅读全文
posted @ 2021-06-08 18:35 谢晨锋 阅读(387) 评论(0) 推荐(0)
上一页 1 ··· 14 15 16 17 18 19 20 21 22 ··· 34 下一页