上一页 1 ··· 4 5 6 7 8 9 10 11 12 ··· 35 下一页
摘要: // 引入框架 const express = require('express'); // 创建网站服务器 const app = express(); app.get('/', (req, res) => { // send() 1 会检测响应内容的类型 2 会自动设置HTTP状态码 3 会自动 阅读全文
posted @ 2020-06-11 15:59 EricBlog 阅读(110) 评论(0) 推荐(0) 编辑
摘要: 生成package.json 文件 // 引入 router模块 const getRouter = require('router'); // 获取路由对象 const router = getRouter(); 安装日期处理时间 插件 // 引入处理日期的第三方模块 const dateform 阅读全文
posted @ 2020-06-11 15:35 EricBlog 阅读(245) 评论(0) 推荐(0) 编辑
摘要: const template = require('art-template'); const path = require('path'); // template 方法是用来拼接字符串的 // 1. 模板路径 绝对路径 // 2. 要在模板中显示的数据 对象类型 // 返回拼接的字符串 cons 阅读全文
posted @ 2020-06-11 13:37 EricBlog 阅读(173) 评论(0) 推荐(0) 编辑
摘要: const http = require('http'); // 连接数据库 const mongoose = require('mongoose'); const url = require('url'); const querystring = require('querystring'); / 阅读全文
posted @ 2020-06-11 11:45 EricBlog 阅读(218) 评论(0) 推荐(0) 编辑
摘要: // 引入 mongoose 第三方模块 用来操作数据库 const mongoose = require('mongoose'); // 数据库连接 mongoose.connect('mongodb://localhost/playground', { useNewUrlParser: true 阅读全文
posted @ 2020-06-10 21:41 EricBlog 阅读(101) 评论(0) 推荐(0) 编辑
摘要: // 引入 mongoose 第三方模块 用来操作数据库 const mongoose = require('mongoose'); // 数据库连接 mongoose.connect('mongodb://localhost/playground', { useNewUrlParser: true 阅读全文
posted @ 2020-06-10 20:37 EricBlog 阅读(320) 评论(0) 推荐(0) 编辑
摘要: // 更新操作 更新一个 // User.updateOne({ // name: '李四' // }, { name: '李狗蛋', age: 98 }).then(result => console.log(result)) // 更新 所有 // User.updateMany({}, { a 阅读全文
posted @ 2020-06-10 20:22 EricBlog 阅读(135) 评论(0) 推荐(0) 编辑
摘要: // 引入 mongoose 第三方模块 用来操作数据库 const mongoose = require('mongoose'); // 数据库连接 mongoose.connect('mongodb://localhost/playground', { useNewUrlParser: true 阅读全文
posted @ 2020-06-10 20:13 EricBlog 阅读(120) 评论(0) 推荐(0) 编辑
摘要: // 查询所有用户集合中的文档 // User.find().then(result => console.log(result)); // 查询一条 // User.find({ // _id: '5c09f294aeb04b22f8460969' // }).then(result => con 阅读全文
posted @ 2020-06-10 20:06 EricBlog 阅读(166) 评论(0) 推荐(0) 编辑
摘要: 导入成功 阅读全文
posted @ 2020-06-10 19:39 EricBlog 阅读(131) 评论(0) 推荐(0) 编辑
上一页 1 ··· 4 5 6 7 8 9 10 11 12 ··· 35 下一页