博客
关于我
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 excel接口自动化测试框架!
    查看>>
    Python exec 函数解析:探索动态代码执行的无限可能!
    查看>>
    Python EXEC和__NAME__
    查看>>
    Python exe文件打包神器-Nuitka!
    查看>>
    python file
    查看>>
    Python FileDialog获取文件夹路径不是文件
    查看>>
    python filter过滤器的使用_python基础知识分享:zip()、filter函数和reduce如何使用?...
    查看>>
    python flask 请求code 400, message Bad request version
    查看>>
    Python Flink Stateful函数入口上的Kafka键访问
    查看>>
    Python float - str - 浮动怪异
    查看>>
    Python Flower库:分布式任务管理与监控
    查看>>
    Python for 循环和迭代器行为
    查看>>
    Python For循环多次返回
    查看>>
    python frame_python3 selenium自动化 frame表单嵌套的切换方法
    查看>>
    Python ftplib - 指定端口
    查看>>
    Python furl库:一键搞定复杂URL操作
    查看>>
    Python GC 也会关闭文件吗?
    查看>>
    python gen_key.py 报错 提示找不到OpenSSL lib
    查看>>
    python getattrribute_Python学习——面向对象高级之反射
    查看>>
    Python进阶语法:字典推导式
    查看>>