上一页 1 ··· 3 4 5 6 7 8 9 10 11 ··· 35 下一页
摘要: 添加字段验证 //引入 joi 模块 const Joi = require('joi'); module.exports = async(req, res) => { // 定义规则对象 const schema = { username: Joi.string().min(2).max(12). 阅读全文
posted @ 2020-06-12 15:51 EricBlog 阅读(148) 评论(0) 推荐(0) 编辑
摘要: 阅读全文
posted @ 2020-06-12 15:15 EricBlog 阅读(159) 评论(0) 推荐(0) 编辑
摘要: 阅读全文
posted @ 2020-06-12 14:46 EricBlog 阅读(84) 评论(0) 推荐(0) 编辑
摘要: // 引入body-parser 模块 用来处理 post 请求参数 const bodyParser = require('body-parser'); // 处理post 请求参数 app.use(bodyParser.urlencoded({extended:false})) npm inst 阅读全文
posted @ 2020-06-12 14:39 EricBlog 阅读(63) 评论(0) 推荐(0) 编辑
摘要: // 引入mongoose 第三方模块 const mongoose = require('mongoose'); // 连接数据库 mongoose.connect('mongodb://localhost/blog', { useNewUrlParser: true, useUnifiedTop 阅读全文
posted @ 2020-06-12 13:11 EricBlog 阅读(113) 评论(0) 推荐(0) 编辑
摘要: 2 生成json文件npm init -y 3 安装项目所需模块npm install express mongoose art-template express-art-template // 引入 express 框架 const express = require('express'); // 阅读全文
posted @ 2020-06-12 10:58 EricBlog 阅读(174) 评论(0) 推荐(0) 编辑
摘要: 阅读全文
posted @ 2020-06-11 18:10 EricBlog 阅读(133) 评论(0) 推荐(0) 编辑
摘要: 虚拟访问目录 阅读全文
posted @ 2020-06-11 17:59 EricBlog 阅读(216) 评论(0) 推荐(0) 编辑
摘要: 阅读全文
posted @ 2020-06-11 17:56 EricBlog 阅读(125) 评论(0) 推荐(0) 编辑
摘要: // 引入框架 const express = require('express'); // 创建网站服务器 const app = express(); app.get('/request', (req, res, next) => { req.name = '张三'; next(); }) ap 阅读全文
posted @ 2020-06-11 16:05 EricBlog 阅读(207) 评论(0) 推荐(0) 编辑
上一页 1 ··· 3 4 5 6 7 8 9 10 11 ··· 35 下一页