博客
关于我
Express路由是如何实现的?
阅读量:208 次
发布时间:2019-02-28

本文共 1069 字,大约阅读时间需要 3 分钟。

Express??????Node.js??????????????????????????Express?????HTTP????????????????URL???????????

Express????????URL????????????????????????????????Express????????

  • ???????

    Express??res.send()???HTTP?????????????????????????????????app??????URL????????????????????????????GET/POST???????????

  • ????

    Express???app.get()?app.post()????????????????????????????????????????/????????????

  • ????

    ???????????????????????????????????????????no router?????POST???Express???????????????????req.body??????????

  • ???????Express??????

    const http = require('http');const ejs = require('ejs');const app = require('express-route');http.createServer(app).listen(3000);// ????app.get('/', (req, res) => {    const msg = '????????';    ejs.renderFile('views/index.ejs', { msg }, (err, data) => {        res.send(data);    });});// ??????app.get('/login', (req, res) => {    ejs.renderFile('views/form.ejs', {}, (err, data) => {        res.send(data);    });});// ??????app.post('/dologin', (req, res) => {    console.log(req.body);    res.send("");});

    ???????????Express??????????????????????HTTP???

    转载地址:http://hgip.baihongyu.com/

    你可能感兴趣的文章
    python
    查看>>
    Python "HTTP Error 403: Forbidden"
    查看>>
    python %ns的作用
    查看>>
    Python + Appium 之 APP 自动化测试,坑点汇总!(建议收藏)
    查看>>
    Python + Appium 自动化操作微信入门(超详细)
    查看>>
    Python + Pytest 自动化框架的用例依赖实操
    查看>>
    python进阶(8):yield函数
    查看>>
    Python + requests实现接口自动化测试!
    查看>>
    python + requests实现的接口自动化测试(超详细~)
    查看>>
    Python + selenium 如何截图?
    查看>>
    Python + Selenium 登录QQ邮箱
    查看>>
    Python + selenium如何做接口自动化测试?
    查看>>
    Python + selenium如何截图!
    查看>>
    Python + selenium自动化生成测试报告!
    查看>>
    Python - C 嵌入式分段错误
    查看>>
    Python - DM 一个用户 Discord 机器人
    查看>>
    python - Flask 基础 - 蓝图( Blueprint )(2)
    查看>>
    python - os.getenv 和 os.environ 看不到我的 bash shell 的环境变量
    查看>>
    Python - while循环
    查看>>
    Python - “if“中的逻辑评估顺序陈述
    查看>>