const express = require("express");

const app = express();

app.listen(8080);

/**
 * 请求方式一
 *  http://localhost:8080/reg?username=zhangsan&password=123456
 */
app.get("/reg",(req,res)=>{
    const {username,password} = req.query;
    console.log(username,password);
})

/**
 * 请求方式二
 *  http://localhost:8080/login/zhangsan/123456
 */
app.get("/login/:username/:password",(req,res)=>{
    const {username,password} = req.params;
    console.log(username,password);
})
posted on 2021-06-08 18:35  文种玉  阅读(373)  评论(0编辑  收藏  举报