摘要: <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>Document< 阅读全文
posted @ 2022-05-31 16:03 hi123hi159 阅读(33) 评论(0) 推荐(0)
摘要: <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8" /> <meta name="viewport" content="width=device-width, initial-scale=1.0" /> <title>Docum 阅读全文
posted @ 2022-05-31 15:21 hi123hi159 阅读(13) 评论(0) 推荐(0)
摘要: 文件1: // 导入 express const express = require('express') // 创建服务器实例 const app = express() // 配置解析表单数据的中间件 app.use(express.urlencoded({ extended: false }) 阅读全文
posted @ 2022-05-31 13:44 hi123hi159 阅读(166) 评论(0) 推荐(0)
摘要: // 导入 express 模块 const express = require('express') // 创建 express 的服务器实例 const app = express() // 导入 Node.js 内置的 querystring 模块 const qs = require('qu 阅读全文
posted @ 2022-05-31 13:19 hi123hi159 阅读(135) 评论(0) 推荐(0)
摘要: // 导入 express 模块 const express = require('express') // 创建 express 的服务器实例 const app = express() // 1. 定义路由 app.get('/', (req, res) => { // 1.1 人为的制造错误 阅读全文
posted @ 2022-05-31 13:11 hi123hi159 阅读(46) 评论(0) 推荐(0)
摘要: // 导入 express 模块 const express = require('express') // 创建 express 的服务器实例 const app = express() // 1. 定义中间件函数 const mw1 = (req, res, next) => { console 阅读全文
posted @ 2022-05-31 12:40 hi123hi159 阅读(21) 评论(0) 推荐(0)
摘要: // 导入 express 模块 const express = require('express') // 创建 express 的服务器实例 const app = express() // 1. 定义中间件函数 const mw1 = (req, res, next) => { console 阅读全文
posted @ 2022-05-31 12:39 hi123hi159 阅读(11) 评论(0) 推荐(0)
摘要: const express = require('express') const app = express() // 定义第一个全局中间件 app.use((req, res, next) => { console.log('调用了第1个全局中间件') next() }) // 定义第二个全局中间 阅读全文
posted @ 2022-05-31 12:38 hi123hi159 阅读(39) 评论(0) 推荐(0)
摘要: const express = require('express') const app = express() // // 定义一个最简单的中间件函数 // const mw = function (req, res, next) { // console.log('这是最简单的中间件函数') / 阅读全文
posted @ 2022-05-31 12:11 hi123hi159 阅读(45) 评论(0) 推荐(0)
摘要: js文件1: const express = require('express') const app = express() // app.use('/files', express.static('./files')) // 1. 导入路由模块 const router = require('. 阅读全文
posted @ 2022-05-31 11:29 hi123hi159 阅读(61) 评论(0) 推荐(0)
摘要: const express = require('express') const app = express() // 挂载路由 app.get('/', (req, res) => { res.send('hello world.') }) app.post('/', (req, res) => 阅读全文
posted @ 2022-05-31 11:20 hi123hi159 阅读(25) 评论(0) 推荐(0)