You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

13 lines
483 B

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

// 导入 Express 路由模块
const express = require('express');
const router = express.Router(); // 创建路由实例
// 导入控制器中的登录方法
const { login } = require('../controllers/userController');
// 定义登录接口POST /api/login前端通过这个路径调用登录
// 为什么用 POST因为登录参数密码放请求体里比 GET 更安全
router.post('/login', login);
// 导出路由,供 app.js 挂载
module.exports = router;